1/*-------------------------------------------------------------------------
3 * Simple list facilities for frontend code
5 * Data structures for simple lists of OIDs and strings. The support for
6 * these is very primitive compared to the backend's List facilities, but
7 * it's all we need in, eg, pg_dump.
10 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
11 * Portions Copyright (c) 1994, Regents of the University of California
13 * src/fe_utils/simple_list.c
15 *-------------------------------------------------------------------------
23 * Append an OID to the list.
35 list->tail->next = cell;
42 * Is OID present in the list?
49 for (cell =
list->head; cell; cell = cell->
next)
58 * Append a string to the list.
60 * The given string is copied, so it need not survive past the call.
75 list->tail->next = cell;
82 * Is string present in the list?
84 * If found, the "touched" field of the first match is set true.
91 for (cell =
list->head; cell; cell = cell->
next)
93 if (strcmp(cell->
val,
val) == 0)
103 * Destroy an OID list
122 * Destroy a string list
141 * Find first not-touched list entry, if there is one.
148 for (cell =
list->head; cell; cell = cell->
next)
157 * Append a pointer to the list.
159 * Caller must ensure that the pointer remains valid.
171 list->tail->next = cell;
178 * Destroy only pointer list and not the pointed-to element
void * pg_malloc(size_t size)
const char * simple_string_list_not_touched(SimpleStringList *list)
void simple_oid_list_destroy(SimpleOidList *list)
bool simple_string_list_member(SimpleStringList *list, const char *val)
void simple_ptr_list_destroy(SimplePtrList *list)
void simple_string_list_append(SimpleStringList *list, const char *val)
void simple_string_list_destroy(SimpleStringList *list)
void simple_ptr_list_append(SimplePtrList *list, void *ptr)
bool simple_oid_list_member(SimpleOidList *list, Oid val)
void simple_oid_list_append(SimpleOidList *list, Oid val)
struct SimpleOidListCell * next
struct SimplePtrListCell * next
char val[FLEXIBLE_ARRAY_MEMBER]
struct SimpleStringListCell * next