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.
This commit is contained in:
Josh Kupershmidt 2012-11-14 19:02:31 -07:00 committed by Daniele Varrazzo
parent 40626769d8
commit decd822393
3 changed files with 16 additions and 16 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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);
/*