From 0bf28f0b6481f60d8f319dc63ad96f0ade0eb9df Mon Sep 17 00:00:00 2001 From: Sweta Vooda Date: Fri, 19 Apr 2024 06:18:08 +0000 Subject: [PATCH] supress warn --- src/pinecone/pinecone_validate.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/pinecone/pinecone_validate.c b/src/pinecone/pinecone_validate.c index 93cfb790..893c8d09 100644 --- a/src/pinecone/pinecone_validate.c +++ b/src/pinecone/pinecone_validate.c @@ -20,27 +20,18 @@ void validate_vector_nonzero(Vector* vector) { } } - +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnonnull" void pinecone_spec_validator(const PineconeOptions *opts) { - if (opts == NULL || cJSON_Parse(GET_STRING_RELOPTION(opts, spec)) == NULL) { + if (opts == NULL || cJSON_Parse(GET_STRING_RELOPTION(opts, spec)) == NULL || strcmp(GET_STRING_RELOPTION(opts, spec), "") == 0) { ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("Invalid spec"), errhint("Spec should be a valid JSON object e.g. WITH (spec='{\"serverless\":{\"cloud\":\"aws\",\"region\":\"us-west-2\"}}').\n \ Refer to https://docs.pinecone.io/reference/create_index"))); - - } else { - const char* spec_str = GET_STRING_RELOPTION(opts, spec); - if (spec_str != NULL && strcmp(spec_str, "") == 0) { - ereport(ERROR, - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("Invalid spec"), - errhint("Spec should be a valid JSON object e.g. WITH (spec='{\"serverless\":{\"cloud\":\"aws\",\"region\":\"us-west-2\"}}').\n \ - Refer to https://docs.pinecone.io/reference/create_index"))); - - } } } +#pragma GCC diagnostic pop void pinecone_host_validator(const char *host) {