Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb0094a7

Browse files
committed
use separate JsQueryItemType enum instead of included in struct
1 parenta0899ff commitb0094a7

File tree

5 files changed

+40
-38
lines changed

5 files changed

+40
-38
lines changed

‎jsquery.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ typedef struct
2929
#definePG_GETARG_JSQUERY(x)DatumGetJsQueryP(PG_GETARG_DATUM(x))
3030
#definePG_RETURN_JSQUERY(p)PG_RETURN_POINTER(p)
3131

32-
33-
typedefstructJsQueryItemJsQueryItem;
34-
35-
structJsQueryItem {
36-
enum {
32+
typedefenumJsQueryItemType {
3733
jqiNull=jbvNull,
3834
jqiString=jbvString,
3935
jqiNumeric=jbvNumeric,
@@ -56,7 +52,12 @@ struct JsQueryItem {
5652
jqiKey='K',
5753
jqiCurrent='$',
5854
jqiIn='I'
59-
}type;
55+
}JsQueryItemType;
56+
57+
typedefstructJsQueryItemJsQueryItem;
58+
59+
structJsQueryItem {
60+
JsQueryItemTypetype;
6061

6162
union {
6263
struct {
@@ -88,7 +89,7 @@ struct JsQueryItem {
8889

8990
externJsQueryItem*parsejsquery(constchar*str,intlen);
9091

91-
int32readJsQueryHeader(char*base,int32pos,int32*type,int32*nextPos);
92+
int32readJsQueryHeader(char*base,int32pos,JsQueryItemType*type,int32*nextPos);
9293

9394
#defineread_byte(v,b,p) do { \
9495
(v) = *(int8*)((b) + (p)); \

‎jsquery_constr.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
staticint32
2323
copyJsQuery(StringInfobuf,char*jqBase,int32jqPos)
2424
{
25-
int32resPos=buf->len-VARHDRSZ;/* position from begining of jsquery data */
26-
int32type,nextPos,chld,next;
25+
int32resPos=buf->len-VARHDRSZ;/* position from begining of jsquery data */
26+
JsQueryItemTypetype;
27+
int32nextPos,chld,next;
2728

2829
check_stack_depth();
2930

@@ -131,7 +132,7 @@ copyJsQuery(StringInfo buf, char *jqBase, int32 jqPos)
131132
}
132133

133134
staticJsQuery*
134-
joinJsQuery(int32type,JsQuery*jq1,JsQuery*jq2)
135+
joinJsQuery(JsQueryItemTypetype,JsQuery*jq1,JsQuery*jq2)
135136
{
136137
JsQuery*out;
137138
StringInfoDatabuf;

‎jsquery_extract.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ static int compareJsQueryValue(JsQueryValue *v1, JsQueryValue *v2);
2222
staticExtractedNode*
2323
recursiveExtract(char*jqBase,int32jqPos,boolindirect,PathItem*path)
2424
{
25-
int32type,childType;
26-
int32nextPos;
27-
int32left,right,arg;
28-
ExtractedNode*leftNode,*rightNode,*result;
29-
int32len,*arrayPos,nelems,i;
30-
PathItem*pathItem;
25+
JsQueryItemTypetype,childType;
26+
int32nextPos;
27+
int32left,right,arg;
28+
ExtractedNode*leftNode,*rightNode,*result;
29+
int32len,*arrayPos,nelems,i;
30+
PathItem*pathItem;
3131

3232
check_stack_depth();
3333

‎jsquery_io.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ jsquery_in(PG_FUNCTION_ARGS)
166166
}
167167

168168
int32
169-
readJsQueryHeader(char*base,int32pos,int32*type,int32*nextPos)
169+
readJsQueryHeader(char*base,int32pos,JsQueryItemType*type,int32*nextPos)
170170
{
171171
read_byte(*type,base,pos);
172172
switch(INTALIGN(pos)-pos)
@@ -183,7 +183,7 @@ readJsQueryHeader(char *base, int32 pos, int32 *type, int32 *nextPos)
183183

184184

185185
staticvoid
186-
printOperation(StringInfobuf,inttype)
186+
printOperation(StringInfobuf,JsQueryItemTypetype)
187187
{
188188
switch(type)
189189
{
@@ -215,8 +215,8 @@ printOperation(StringInfo buf, int type)
215215
staticvoid
216216
printJsQueryItem(StringInfobuf,char*base,int32pos,boolinKey,boolprintBracketes)
217217
{
218-
int32type;
219-
int32nextPos;
218+
JsQueryItemTypetype;
219+
int32nextPos;
220220

221221
check_stack_depth();
222222

‎jsquery_op.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ recursiveAny(char *jqBase, int32 jqPos, JsonbValue *jb)
9292
}
9393

9494
staticbool
95-
checkEquality(char*jqBase,int32jqPos,int32type,JsonbValue*jb)
95+
checkEquality(char*jqBase,int32jqPos,JsQueryItemTypetype,JsonbValue*jb)
9696
{
9797
intlen;
9898

@@ -123,7 +123,7 @@ checkEquality(char *jqBase, int32 jqPos, int32 type, JsonbValue *jb)
123123
}
124124

125125
staticbool
126-
checkArrayEquality(char*jqBase,int32jqPos,int32type,JsonbValue*jb)
126+
checkArrayEquality(char*jqBase,int32jqPos,JsQueryItemTypetype,JsonbValue*jb)
127127
{
128128
int32i,nelems,*arrayPos;
129129
int32r;
@@ -159,7 +159,7 @@ checkArrayEquality(char *jqBase, int32 jqPos, int32 type, JsonbValue *jb)
159159
}
160160

161161
staticbool
162-
checkIn(char*jqBase,int32jqPos,int32type,JsonbValue*jb)
162+
checkIn(char*jqBase,int32jqPos,JsQueryItemTypetype,JsonbValue*jb)
163163
{
164164
int32i,nelems,*arrayPos;
165165

@@ -180,7 +180,7 @@ checkIn(char *jqBase, int32 jqPos, int32 type, JsonbValue *jb)
180180
}
181181

182182
staticbool
183-
executeArrayOp(char*jqBase,int32jqPos,int32type,int32op,JsonbValue*jb)
183+
executeArrayOp(char*jqBase,int32jqPos,JsQueryItemTypetype,int32op,JsonbValue*jb)
184184
{
185185
int32i,nelems,*arrayPos;
186186
int32r;
@@ -252,7 +252,7 @@ executeArrayOp(char *jqBase, int32 jqPos, int32 type, int32 op, JsonbValue *jb)
252252
}
253253

254254
staticbool
255-
makeCompare(char*jqBase,int32jqPos,int32type,int32op,JsonbValue*jb)
255+
makeCompare(char*jqBase,int32jqPos,JsQueryItemTypetype,int32op,JsonbValue*jb)
256256
{
257257
intres;
258258

@@ -283,8 +283,8 @@ makeCompare(char *jqBase, int32 jqPos, int32 type, int32 op, JsonbValue *jb)
283283
staticbool
284284
executeExpr(char*jqBase,int32jqPos,int32op,JsonbValue*jb)
285285
{
286-
int32type;
287-
int32nextPos;
286+
JsQueryItemTypetype;
287+
int32nextPos;
288288

289289
check_stack_depth();
290290

@@ -324,10 +324,10 @@ executeExpr(char *jqBase, int32 jqPos, int32 op, JsonbValue *jb)
324324
staticbool
325325
recursiveExecute(char*jqBase,int32jqPos,JsonbValue*jb)
326326
{
327-
int32type;
328-
int32nextPos;
329-
int32left,right,arg;
330-
boolres= false;
327+
JsQueryItemTypetype;
328+
int32nextPos;
329+
int32left,right,arg;
330+
boolres= false;
331331

332332
check_stack_depth();
333333

@@ -497,11 +497,11 @@ json_jsquery_exec(PG_FUNCTION_ARGS)
497497
staticint
498498
compareJsQuery(char*base1,int32pos1,char*base2,int32pos2)
499499
{
500-
int32type1,
501-
nextPos1,
502-
type2,
503-
nextPos2;
504-
int32res=0;
500+
JsQueryItemTypetype1,
501+
type2;
502+
int32nextPos1,
503+
nextPos2;
504+
int32res=0;
505505

506506
check_stack_depth();
507507

@@ -730,8 +730,8 @@ jsquery_gt(PG_FUNCTION_ARGS)
730730
staticvoid
731731
hashJsQuery(char*base,int32pos,pg_crc32*crc)
732732
{
733-
int32type;
734-
int32nextPos;
733+
JsQueryItemTypetype;
734+
int32nextPos;
735735

736736
check_stack_depth();
737737

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp