Skip to content

Commit

Permalink
Fix compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ildus committed Apr 17, 2018
1 parent 837b8b7 commit 81e25a0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
16 changes: 8 additions & 8 deletions jsonb_gin_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ gin_extract_jsonb_value_path_internal(Jsonb *jb, int32 *nentries, uint32 **bloom
Datum
gin_extract_jsonb_value_path(PG_FUNCTION_ARGS)
{
Jsonb *jb = PG_GETARG_JSONB(0);
Jsonb *jb = PG_GETARG_JSONB_P(0);
int32 *nentries = (int32 *) PG_GETARG_POINTER(1);

PG_RETURN_POINTER(gin_extract_jsonb_value_path_internal(jb, nentries, NULL));
Expand Down Expand Up @@ -770,12 +770,12 @@ gin_extract_jsonb_query_value_path(PG_FUNCTION_ARGS)
switch(strategy)
{
case JsonbContainsStrategyNumber:
jb = PG_GETARG_JSONB(0);
jb = PG_GETARG_JSONB_P(0);
entries = gin_extract_jsonb_value_path_internal(jb, nentries, NULL);
break;

case JsonbNestedContainsStrategyNumber:
jb = PG_GETARG_JSONB(0);
jb = PG_GETARG_JSONB_P(0);
entries = gin_extract_jsonb_value_path_internal(jb, nentries, &bloom);

n = *nentries;
Expand Down Expand Up @@ -867,7 +867,7 @@ gin_triconsistent_jsonb_value_path(PG_FUNCTION_ARGS)
{
GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
/* Jsonb *query = PG_GETARG_JSONB(2); */
/* Jsonb *query = PG_GETARG_JSONB_P(2); */
int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
GinTernaryValue res = GIN_TRUE;
Expand Down Expand Up @@ -1171,7 +1171,7 @@ gin_extract_jsonb_path_value_internal(Jsonb *jb, int32 *nentries)
Datum
gin_extract_jsonb_path_value(PG_FUNCTION_ARGS)
{
Jsonb *jb = PG_GETARG_JSONB(0);
Jsonb *jb = PG_GETARG_JSONB_P(0);
int32 *nentries = (int32 *) PG_GETARG_POINTER(1);

PG_RETURN_POINTER(gin_extract_jsonb_path_value_internal(jb, nentries));
Expand Down Expand Up @@ -1209,7 +1209,7 @@ gin_extract_jsonb_query_path_value(PG_FUNCTION_ARGS)
switch(strategy)
{
case JsonbContainsStrategyNumber:
jb = PG_GETARG_JSONB(0);
jb = PG_GETARG_JSONB_P(0);
entries = gin_extract_jsonb_path_value_internal(jb, nentries);
break;

Expand Down Expand Up @@ -1250,7 +1250,7 @@ gin_consistent_jsonb_path_value(PG_FUNCTION_ARGS)
{
bool *check = (bool *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
/* Jsonb *query = PG_GETARG_JSONB(2); */
/* Jsonb *query = PG_GETARG_JSONB_P(2); */
int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
bool *recheck = (bool *) PG_GETARG_POINTER(5);
Expand Down Expand Up @@ -1291,7 +1291,7 @@ gin_triconsistent_jsonb_path_value(PG_FUNCTION_ARGS)
{
GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
/* Jsonb *query = PG_GETARG_JSONB(2); */
/* Jsonb *query = PG_GETARG_JSONB_P(2); */
int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
GinTernaryValue res = GIN_TRUE;
Expand Down
8 changes: 8 additions & 0 deletions jsquery.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,12 @@ bool queryNeedRecheck(ExtractedNode *node);
bool execRecursive(ExtractedNode *node, bool *check);
bool execRecursiveTristate(ExtractedNode *node, GinTernaryValue *check);

#ifndef PG_RETURN_JSONB_P
#define PG_RETURN_JSONB_P(x) PG_RETURN_JSONB(x)
#endif

#ifndef PG_GETARG_JSONB_P
#define PG_GETARG_JSONB_P(x) PG_GETARG_JSONB(x)
#endif

#endif
4 changes: 2 additions & 2 deletions jsquery_extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ execRecursiveTristate(ExtractedNode *node, GinTernaryValue *check)
res = GIN_TRUE;
for (i = 0; i < node->args.count; i++)
{
v = execRecursive(node->args.items[i], check);
v = execRecursive(node->args.items[i], (bool *) check);
if (v == GIN_FALSE)
return GIN_FALSE;
else if (v == GIN_MAYBE)
Expand All @@ -879,7 +879,7 @@ execRecursiveTristate(ExtractedNode *node, GinTernaryValue *check)
res = GIN_FALSE;
for (i = 0; i < node->args.count; i++)
{
v = execRecursive(node->args.items[i], check);
v = execRecursive(node->args.items[i], (bool *) check);
if (v == GIN_TRUE)
return GIN_TRUE;
else if (v == GIN_MAYBE)
Expand Down
12 changes: 6 additions & 6 deletions jsquery_op.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ Datum
jsquery_json_exec(PG_FUNCTION_ARGS)
{
JsQuery *jq = PG_GETARG_JSQUERY(0);
Jsonb *jb = PG_GETARG_JSONB(1);
Jsonb *jb = PG_GETARG_JSONB_P(1);
bool res;
JsonbValue jbv;
JsQueryItem jsq;
Expand All @@ -803,7 +803,7 @@ PG_FUNCTION_INFO_V1(json_jsquery_exec);
Datum
json_jsquery_exec(PG_FUNCTION_ARGS)
{
Jsonb *jb = PG_GETARG_JSONB(0);
Jsonb *jb = PG_GETARG_JSONB_P(0);
JsQuery *jq = PG_GETARG_JSQUERY(1);
bool res;
JsonbValue jbv;
Expand All @@ -827,7 +827,7 @@ PG_FUNCTION_INFO_V1(json_jsquery_filter);
Datum
json_jsquery_filter(PG_FUNCTION_ARGS)
{
Jsonb *jb = PG_GETARG_JSONB(0);
Jsonb *jb = PG_GETARG_JSONB_P(0);
JsQuery *jq = PG_GETARG_JSQUERY(1);
Jsonb *res = NULL;
JsonbValue jbv;
Expand All @@ -854,9 +854,9 @@ json_jsquery_filter(PG_FUNCTION_ARGS)
PG_FREE_IF_COPY(jq, 1);

if (res)
PG_RETURN_JSONB(res);
else
PG_RETURN_NULL();
PG_RETURN_JSONB_P(res);

PG_RETURN_NULL();
}


Expand Down

0 comments on commit 81e25a0

Please sign in to comment.