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

Commitcc0e7eb

Browse files
committed
reindexdb: Fix warning about uninitialized indices_tables_cell
Initialize indices_tables_cell with NULL to silence the warning. Also,refactor the place of the first assignment of indices_tables_cell.Reported-by: Thomas Munro, David Rowley, Tom Lane, Richard GuoDiscussion:https://postgr.es/m/2348025.1711332418%40sss.pgh.pa.usDiscussion:https://postgr.es/m/E1roXs4-005UdX-1V%40gemulon.postgresql.org
1 parent6190d82 commitcc0e7eb

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

‎src/bin/scripts/reindexdb.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ reindex_one_database(ConnParams *cparams, ReindexType type,
277277
{
278278
PGconn*conn;
279279
SimpleStringListCell*cell;
280-
SimpleStringListCell*indices_tables_cell;
280+
SimpleStringListCell*indices_tables_cell=NULL;
281281
boolparallel=concurrentCons>1;
282282
SimpleStringList*process_list=user_list;
283283
SimpleStringList*indices_tables_list=NULL;
@@ -366,12 +366,20 @@ reindex_one_database(ConnParams *cparams, ReindexType type,
366366
indices_tables_list=get_parallel_object_list(conn,process_type,
367367
user_list,echo);
368368

369-
if (indices_tables_list)
370-
indices_tables_cell=indices_tables_list->head;
371-
372-
/* Bail out if nothing to process */
373-
if (process_list==NULL)
369+
/*
370+
* Bail out if nothing to process. 'user_list' was modified
371+
* in-place, so check if it has at least one cell.
372+
*/
373+
if (user_list->head==NULL)
374374
return;
375+
376+
/*
377+
* Assuming 'user_list' is not empty, 'indices_tables_list'
378+
* shouldn't be empty as well.
379+
*/
380+
Assert(indices_tables_list!=NULL);
381+
indices_tables_cell=indices_tables_list->head;
382+
375383
break;
376384

377385
caseREINDEX_SYSTEM:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp