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

Commita069218

Browse files
committed
In jsonb_plpython.c, suppress warning message from gcc 10.
Very recent gcc complains that PLyObject_ToJsonbValue could returna pointer to a local variable. I think it's wrong; but the codingis fragile enough, and the savings of one palloc() minimal enough,that it seems better to just do a palloc() all the time. (My otheridea of tweaking the if-condition doesn't suppress the warning.)Back-patch to v11 where this code was introduced.Discussion:https://postgr.es/m/21547.1580170366@sss.pgh.pa.us
1 parent74618e7 commita069218

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

‎contrib/jsonb_plpython/jsonb_plpython.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ PLyNumber_ToJsonbValue(PyObject *obj, JsonbValue *jbvNum)
410410
staticJsonbValue*
411411
PLyObject_ToJsonbValue(PyObject*obj,JsonbParseState**jsonb_state,boolis_elem)
412412
{
413-
JsonbValuebuf;
414413
JsonbValue*out;
415414

416415
if (!(PyString_Check(obj)||PyUnicode_Check(obj)))
@@ -421,11 +420,7 @@ PLyObject_ToJsonbValue(PyObject *obj, JsonbParseState **jsonb_state, bool is_ele
421420
returnPLyMapping_ToJsonbValue(obj,jsonb_state);
422421
}
423422

424-
/* Allocate JsonbValue in heap only if it is raw scalar value. */
425-
if (*jsonb_state)
426-
out=&buf;
427-
else
428-
out=palloc(sizeof(JsonbValue));
423+
out=palloc(sizeof(JsonbValue));
429424

430425
if (obj==Py_None)
431426
out->type=jbvNull;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp