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

Commit2789b72

Browse files
committed
Volatile-qualify a dozen variables in plpython.c to eliminate warnings
from old versions of gcc. It's not clear to me that this is reallynecessary for correctness, but less warnings are always good.Per buildfarm results and local testing.
1 parent39f06dc commit2789b72

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

‎src/pl/plpython/plpython.c

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**********************************************************************
22
* plpython.c - python as a procedural language for PostgreSQL
33
*
4-
*$PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.101 2007/05/31 15:13:05 petere Exp $
4+
*$PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.102 2007/07/13 04:57:59 tgl Exp $
55
*
66
*********************************************************************
77
*/
@@ -1714,7 +1714,7 @@ PLyMapping_ToTuple(PLyTypeInfo * info, PyObject * mapping)
17141714
HeapTupletuple;
17151715
Datum*values;
17161716
char*nulls;
1717-
inti;
1717+
volatileinti;
17181718

17191719
Assert(PyMapping_Check(mapping));
17201720

@@ -1729,8 +1729,8 @@ PLyMapping_ToTuple(PLyTypeInfo * info, PyObject * mapping)
17291729
for (i=0;i<desc->natts;++i)
17301730
{
17311731
char*key;
1732-
PyObject*value,
1733-
*so;
1732+
PyObject*volatilevalue,
1733+
*volatileso;
17341734

17351735
key=NameStr(desc->attrs[i]->attname);
17361736
value=so=NULL;
@@ -1794,7 +1794,7 @@ PLySequence_ToTuple(PLyTypeInfo * info, PyObject * sequence)
17941794
HeapTupletuple;
17951795
Datum*values;
17961796
char*nulls;
1797-
inti;
1797+
volatileinti;
17981798

17991799
Assert(PySequence_Check(sequence));
18001800

@@ -1818,8 +1818,8 @@ PLySequence_ToTuple(PLyTypeInfo * info, PyObject * sequence)
18181818
nulls=palloc(sizeof(char)*desc->natts);
18191819
for (i=0;i<desc->natts;++i)
18201820
{
1821-
PyObject*value,
1822-
*so;
1821+
PyObject*volatilevalue,
1822+
*volatileso;
18231823

18241824
value=so=NULL;
18251825
PG_TRY();
@@ -1876,7 +1876,7 @@ PLyObject_ToTuple(PLyTypeInfo * info, PyObject * object)
18761876
HeapTupletuple;
18771877
Datum*values;
18781878
char*nulls;
1879-
inti;
1879+
volatileinti;
18801880

18811881
desc=lookup_rowtype_tupdesc(info->out.d.typoid,-1);
18821882
if (info->is_rowtype==2)
@@ -1889,8 +1889,8 @@ PLyObject_ToTuple(PLyTypeInfo * info, PyObject * object)
18891889
for (i=0;i<desc->natts;++i)
18901890
{
18911891
char*key;
1892-
PyObject*value,
1893-
*so;
1892+
PyObject*volatilevalue,
1893+
*volatileso;
18941894

18951895
key=NameStr(desc->attrs[i]->attname);
18961896
value=so=NULL;
@@ -2473,13 +2473,14 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, long limit)
24732473
PG_TRY();
24742474
{
24752475
char*nulls=palloc(nargs*sizeof(char));
2476+
volatileintj;
24762477

2477-
for (i=0;i<nargs;i++)
2478+
for (j=0;j<nargs;j++)
24782479
{
24792480
PyObject*elem,
24802481
*so;
24812482

2482-
elem=PySequence_GetItem(list,i);
2483+
elem=PySequence_GetItem(list,j);
24832484
if (elem!=Py_None)
24842485
{
24852486
so=PyObject_Str(elem);
@@ -2492,10 +2493,10 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, long limit)
24922493
{
24932494
char*sv=PyString_AsString(so);
24942495

2495-
plan->values[i]=
2496-
InputFunctionCall(&(plan->args[i].out.d.typfunc),
2496+
plan->values[j]=
2497+
InputFunctionCall(&(plan->args[j].out.d.typfunc),
24972498
sv,
2498-
plan->args[i].out.d.typioparam,
2499+
plan->args[j].out.d.typioparam,
24992500
-1);
25002501
}
25012502
PG_CATCH();
@@ -2506,17 +2507,17 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, long limit)
25062507
PG_END_TRY();
25072508

25082509
Py_DECREF(so);
2509-
nulls[i]=' ';
2510+
nulls[j]=' ';
25102511
}
25112512
else
25122513
{
25132514
Py_DECREF(elem);
2514-
plan->values[i]=
2515-
InputFunctionCall(&(plan->args[i].out.d.typfunc),
2515+
plan->values[j]=
2516+
InputFunctionCall(&(plan->args[j].out.d.typfunc),
25162517
NULL,
2517-
plan->args[i].out.d.typioparam,
2518+
plan->args[j].out.d.typioparam,
25182519
-1);
2519-
nulls[i]='n';
2520+
nulls[j]='n';
25202521
}
25212522
}
25222523

@@ -2527,20 +2528,22 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, long limit)
25272528
}
25282529
PG_CATCH();
25292530
{
2531+
intk;
2532+
25302533
MemoryContextSwitchTo(oldcontext);
25312534
PLy_error_in_progress=CopyErrorData();
25322535
FlushErrorState();
25332536

25342537
/*
25352538
* cleanup plan->values array
25362539
*/
2537-
for (i=0;i<nargs;i++)
2540+
for (k=0;k<nargs;k++)
25382541
{
2539-
if (!plan->args[i].out.d.typbyval&&
2540-
(plan->values[i]!=PointerGetDatum(NULL)))
2542+
if (!plan->args[k].out.d.typbyval&&
2543+
(plan->values[k]!=PointerGetDatum(NULL)))
25412544
{
2542-
pfree(DatumGetPointer(plan->values[i]));
2543-
plan->values[i]=PointerGetDatum(NULL);
2545+
pfree(DatumGetPointer(plan->values[k]));
2546+
plan->values[k]=PointerGetDatum(NULL);
25442547
}
25452548
}
25462549

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp