1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Fix possibly-uninitialized-variable warning from commit 9556aa01c.

Heikki's compiler doesn't complain about end_ptr, apparently,
but mine does.

In passing, I failed to resist the temptation to remove the
no-longer-used fldnum variable, and relocate chunk_len's
declaration to a narrower scope.
This commit is contained in:
Tom Lane
2019-01-25 11:27:44 -05:00
parent 9556aa01c6
commit 6119060d01

View File

@ -4613,8 +4613,6 @@ text_to_array_internal(PG_FUNCTION_ARGS)
* to search for occurrences of fldsep.
*/
TextPositionState state;
int fldnum;
int chunk_len;
inputstring_len = VARSIZE_ANY_EXHDR(inputstring);
fldsep_len = VARSIZE_ANY_EXHDR(fldsep);
@ -4651,10 +4649,11 @@ text_to_array_internal(PG_FUNCTION_ARGS)
start_ptr = VARDATA_ANY(inputstring);
for (fldnum = 1;; fldnum++) /* field number is 1 based */
for (;;)
{
bool found;
char *end_ptr;
int chunk_len;
CHECK_FOR_INTERRUPTS();
@ -4663,6 +4662,7 @@ text_to_array_internal(PG_FUNCTION_ARGS)
{
/* fetch last field */
chunk_len = ((char *) inputstring + VARSIZE_ANY(inputstring)) - start_ptr;
end_ptr = NULL; /* not used, but some compilers complain */
}
else
{