Skip to content

Commit decd822

Browse files
schmiddydvarrazzo
authored andcommitted
Move simple_string_list_size() into pgut.c, with the rest of these string functions.
Also, fix an error with this function not actually using its string_list argument.
1 parent 4062676 commit decd822

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

bin/pg_repack.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ static Oid getoid(PGresult *res, int row, int col);
116116
static bool lock_exclusive(PGconn *conn, const char *relid, const char *lock_query, bool start_xact);
117117
static bool kill_ddl(PGconn *conn, Oid relid, bool terminate);
118118
static bool lock_access_share(PGconn *conn, Oid relid, const char *target_name);
119-
static size_t simple_string_list_size(SimpleStringList string_list);
120119

121120
#define SQLSTATE_INVALID_SCHEMA_NAME "3F000"
122121
#define SQLSTATE_QUERY_CANCELED "57014"
@@ -248,21 +247,6 @@ getoid(PGresult *res, int row, int col)
248247
return (Oid)strtoul(PQgetvalue(res, row, col), NULL, 10);
249248
}
250249

251-
/* Returns the number of elements in the given SimpleStringList */
252-
static size_t
253-
simple_string_list_size(SimpleStringList string_list)
254-
{
255-
size_t i = 0;
256-
SimpleStringListCell *cell = table_list.head;
257-
258-
while (cell)
259-
{
260-
cell = cell->next;
261-
i++;
262-
}
263-
264-
return i;
265-
}
266250

267251
/*
268252
* Call repack_one_table for the target table or each table in a database.

bin/pgut/pgut.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,21 @@ simple_string_list_member(SimpleStringList *list, const char *val)
417417
return false;
418418
}
419419

420+
/* Returns the number of elements in the given SimpleStringList */
421+
size_t
422+
simple_string_list_size(SimpleStringList string_list)
423+
{
424+
size_t i = 0;
425+
SimpleStringListCell *cell = string_list.head;
426+
427+
while (cell)
428+
{
429+
cell = cell->next;
430+
i++;
431+
}
432+
433+
return i;
434+
}
420435

421436
static char *
422437
prompt_for_password(void)

bin/pgut/pgut.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ typedef struct SimpleStringList
186186

187187
extern void simple_string_list_append(SimpleStringList *list, const char *val);
188188
extern bool simple_string_list_member(SimpleStringList *list, const char *val);
189+
extern size_t simple_string_list_size(SimpleStringList string_list);
189190

190191

191192
/*

0 commit comments

Comments
 (0)