Skip to content

Commit

Permalink
supress warn
Browse files Browse the repository at this point in the history
  • Loading branch information
swetavooda committed Apr 19, 2024
1 parent 94254f9 commit 0bf28f0
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/pinecone/pinecone_validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 0bf28f0

Please sign in to comment.