From decd8223937eceadcf5479a445c614548a3ac18b Mon Sep 17 00:00:00 2001 From: Josh Kupershmidt Date: Wed, 14 Nov 2012 19:02:31 -0700 Subject: [PATCH] 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. --- bin/pg_repack.c | 16 ---------------- bin/pgut/pgut.c | 15 +++++++++++++++ bin/pgut/pgut.h | 1 + 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bin/pg_repack.c b/bin/pg_repack.c index 20e5756..ec25251 100644 --- a/bin/pg_repack.c +++ b/bin/pg_repack.c @@ -116,7 +116,6 @@ static Oid getoid(PGresult *res, int row, int col); static bool lock_exclusive(PGconn *conn, const char *relid, const char *lock_query, bool start_xact); static bool kill_ddl(PGconn *conn, Oid relid, bool terminate); static bool lock_access_share(PGconn *conn, Oid relid, const char *target_name); -static size_t simple_string_list_size(SimpleStringList string_list); #define SQLSTATE_INVALID_SCHEMA_NAME "3F000" #define SQLSTATE_QUERY_CANCELED "57014" @@ -248,21 +247,6 @@ getoid(PGresult *res, int row, int col) return (Oid)strtoul(PQgetvalue(res, row, col), NULL, 10); } -/* Returns the number of elements in the given SimpleStringList */ -static size_t -simple_string_list_size(SimpleStringList string_list) -{ - size_t i = 0; - SimpleStringListCell *cell = table_list.head; - - while (cell) - { - cell = cell->next; - i++; - } - - return i; -} /* * Call repack_one_table for the target table or each table in a database. diff --git a/bin/pgut/pgut.c b/bin/pgut/pgut.c index 5a86330..4661126 100644 --- a/bin/pgut/pgut.c +++ b/bin/pgut/pgut.c @@ -417,6 +417,21 @@ simple_string_list_member(SimpleStringList *list, const char *val) return false; } +/* Returns the number of elements in the given SimpleStringList */ +size_t +simple_string_list_size(SimpleStringList string_list) +{ + size_t i = 0; + SimpleStringListCell *cell = string_list.head; + + while (cell) + { + cell = cell->next; + i++; + } + + return i; +} static char * prompt_for_password(void) diff --git a/bin/pgut/pgut.h b/bin/pgut/pgut.h index f0b0f99..5abbe30 100644 --- a/bin/pgut/pgut.h +++ b/bin/pgut/pgut.h @@ -186,6 +186,7 @@ typedef struct SimpleStringList extern void simple_string_list_append(SimpleStringList *list, const char *val); extern bool simple_string_list_member(SimpleStringList *list, const char *val); +extern size_t simple_string_list_size(SimpleStringList string_list); /*