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

Appearance settings

Commit e9928b8

Browse filesBrowse files
committed
Prevent misoptimization of register variable, also for consitency added
jsqIterateDestroy.
1 parent 5ec2b22 commit e9928b8
Copy full SHA for e9928b8

File tree

3 files changed

+14
-3
lines changed
Filter options

3 files changed

+14
-3
lines changed

‎jsquery.h

Copy file name to clipboardExpand all lines: jsquery.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ extern int32 jsqGetIsType(JsQueryItem *v);
123123
extern char * jsqGetString(JsQueryItem *v, int32 *len);
124124
extern void jsqIterateInit(JsQueryItem *v);
125125
extern bool jsqIterateArray(JsQueryItem *v, JsQueryItem *e);
126+
extern void jsqIterateDestroy(JsQueryItem *v);
126127

127128
void alignStringInfoInt(StringInfo buf);
128129

‎jsquery_op.c

Copy file name to clipboardExpand all lines: jsquery_op.c
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ executeArrayOp(JsQueryItem *jsq, int32 op, JsonbValue *jb)
273273
int32 r = 0; /* keep static analyzer quiet */
274274
JsonbIterator *it;
275275
JsonbValue v;
276-
JsQueryItem elem;
276+
JsQueryItem elem;
277+
bool res;
277278

278279
if (JsonbType(jb) != jbvArray)
279280
return false;
@@ -284,7 +285,7 @@ executeArrayOp(JsQueryItem *jsq, int32 op, JsonbValue *jb)
284285
{
285286
while(jsqIterateArray(jsq, &elem))
286287
{
287-
bool res = false;
288+
res = false;
288289

289290
it = JsonbIteratorInit(jb->val.binary.data);
290291

@@ -306,7 +307,7 @@ executeArrayOp(JsQueryItem *jsq, int32 op, JsonbValue *jb)
306307
{
307308
if (r == WJB_ELEM)
308309
{
309-
bool res = false;
310+
res = false;
310311

311312
jsqIterateInit(jsq);
312313
while(jsqIterateArray(jsq, &elem))
@@ -319,6 +320,7 @@ executeArrayOp(JsQueryItem *jsq, int32 op, JsonbValue *jb)
319320
break;
320321
}
321322
}
323+
jsqIterateDestroy(jsq);
322324

323325
if (op == jqiContained && res == false)
324326
return false;

‎jsquery_support.c

Copy file name to clipboardExpand all lines: jsquery_support.c
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,11 @@ jsqIterateArray(JsQueryItem *v, JsQueryItem *e)
252252
}
253253
}
254254

255+
void
256+
jsqIterateDestroy(JsQueryItem *v)
257+
{
258+
Assert(v->type == jqiArray);
259+
Assert(v->array.current <= v->array.current);
260+
v->array.current++;
261+
}
262+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.