PostgreSQL Source Code git master
simple_list.c File Reference
#include "postgres_fe.h"
#include "fe_utils/simple_list.h"
Include dependency graph for simple_list.c:

Go to the source code of this file.

Functions

void simple_oid_list_append (SimpleOidList *list, Oid val)
 
bool simple_oid_list_member (SimpleOidList *list, Oid val)
 
void simple_string_list_append (SimpleStringList *list, const char *val)
 
bool simple_string_list_member (SimpleStringList *list, const char *val)
 
void simple_oid_list_destroy (SimpleOidList *list)
 
void simple_string_list_destroy (SimpleStringList *list)
 
const char * simple_string_list_not_touched (SimpleStringList *list)
 
void simple_ptr_list_append (SimplePtrList *list, void *ptr)
 
void simple_ptr_list_destroy (SimplePtrList *list)
 

Function Documentation

◆ simple_oid_list_append()

void simple_oid_list_append ( SimpleOidList list,
Oid  val 
)

Definition at line 26 of file simple_list.c.

27{
29
31 cell->next = NULL;
32 cell->val = val;
33
34 if (list->tail)
35 list->tail->next = cell;
36 else
37 list->head = cell;
38 list->tail = cell;
39}
void * pg_malloc(size_t size)
Definition: fe_memutils.c:47
long val
Definition: informix.c:689
struct SimpleOidListCell * next
Definition: simple_list.h:22

References sort-test::list, SimpleOidListCell::next, pg_malloc(), SimpleOidListCell::val, and val.

Referenced by expand_extension_name_patterns(), expand_foreign_server_name_patterns(), expand_schema_name_patterns(), expand_table_name_patterns(), and get_parallel_tabidx_list().

◆ simple_oid_list_destroy()

void simple_oid_list_destroy ( SimpleOidList list)

Definition at line 106 of file simple_list.c.

107{
108 SimpleOidListCell *cell;
109
110 cell = list->head;
111 while (cell != NULL)
112 {
114
115 next = cell->next;
116 pg_free(cell);
117 cell = next;
118 }
119}
static int32 next
Definition: blutils.c:224
void pg_free(void *ptr)
Definition: fe_memutils.c:105

References sort-test::list, next, SimpleOidListCell::next, and pg_free().

Referenced by reindex_one_database().

◆ simple_oid_list_member()

bool simple_oid_list_member ( SimpleOidList list,
Oid  val 
)

Definition at line 45 of file simple_list.c.

46{
48
49 for (cell = list->head; cell; cell = cell->next)
50 {
51 if (cell->val == val)
52 return true;
53 }
54 return false;
55}

References sort-test::list, SimpleOidListCell::next, SimpleOidListCell::val, and val.

Referenced by makeTableDataInfo(), processExtensionTables(), selectDumpableExtension(), selectDumpableNamespace(), and selectDumpableTable().

◆ simple_ptr_list_append()

void simple_ptr_list_append ( SimplePtrList list,
void *  ptr 
)

Definition at line 162 of file simple_list.c.

163{
164 SimplePtrListCell *cell;
165
167 cell->next = NULL;
168 cell->ptr = ptr;
169
170 if (list->tail)
171 list->tail->next = cell;
172 else
173 list->head = cell;
174 list->tail = cell;
175}
struct SimplePtrListCell * next
Definition: simple_list.h:48

References sort-test::list, SimplePtrListCell::next, pg_malloc(), and SimplePtrListCell::ptr.

Referenced by compile_database_list(), compile_relation_list_one_db(), flagInhIndexes(), and precheck_tar_backup_file().

◆ simple_ptr_list_destroy()

void simple_ptr_list_destroy ( SimplePtrList list)

Definition at line 181 of file simple_list.c.

182{
183 SimplePtrListCell *cell;
184
185 cell = list->head;
186 while (cell != NULL)
187 {
189
190 next = cell->next;
191 pg_free(cell);
192 cell = next;
193 }
194}

References sort-test::list, next, SimplePtrListCell::next, and pg_free().

Referenced by verify_tar_backup().

◆ simple_string_list_append()

void simple_string_list_append ( SimpleStringList list,
const char *  val 
)

Definition at line 63 of file simple_list.c.

64{
66
67 cell = (SimpleStringListCell *)
68 pg_malloc(offsetof(SimpleStringListCell, val) + strlen(val) + 1);
69
70 cell->next = NULL;
71 cell->touched = false;
72 strcpy(cell->val, val);
73
74 if (list->tail)
75 list->tail->next = cell;
76 else
77 list->head = cell;
78 list->tail = cell;
79}
char val[FLEXIBLE_ARRAY_MEMBER]
Definition: simple_list.h:37
struct SimpleStringListCell * next
Definition: simple_list.h:34

References sort-test::list, SimpleStringListCell::next, pg_malloc(), SimpleStringListCell::touched, SimpleStringListCell::val, and val.

Referenced by expand_dbname_patterns(), get_parallel_tabidx_list(), get_parallel_tables_list(), main(), read_dump_filters(), read_dumpall_filters(), read_restore_filters(), reindex_one_database(), retrieve_objects(), verify_plain_backup_directory(), and verify_plain_backup_file().

◆ simple_string_list_destroy()

void simple_string_list_destroy ( SimpleStringList list)

Definition at line 125 of file simple_list.c.

126{
128
129 cell = list->head;
130 while (cell != NULL)
131 {
133
134 next = cell->next;
135 pg_free(cell);
136 cell = next;
137 }
138}

References sort-test::list, next, SimpleStringListCell::next, and pg_free().

Referenced by get_parallel_tabidx_list(), and reindex_one_database().

◆ simple_string_list_member()

bool simple_string_list_member ( SimpleStringList list,
const char *  val 
)

Definition at line 87 of file simple_list.c.

88{
90
91 for (cell = list->head; cell; cell = cell->next)
92 {
93 if (strcmp(cell->val, val) == 0)
94 {
95 cell->touched = true;
96 return true;
97 }
98 }
99 return false;
100}

References sort-test::list, SimpleStringListCell::next, SimpleStringListCell::touched, SimpleStringListCell::val, and val.

Referenced by _tocEntryRequired(), dumpDatabases(), and main().

◆ simple_string_list_not_touched()

const char * simple_string_list_not_touched ( SimpleStringList list)

Definition at line 144 of file simple_list.c.

145{
147
148 for (cell = list->head; cell; cell = cell->next)
149 {
150 if (!cell->touched)
151 return cell->val;
152 }
153 return NULL;
154}

References sort-test::list, SimpleStringListCell::next, SimpleStringListCell::touched, and SimpleStringListCell::val.

Referenced by StrictNamesCheck().