PostgreSQL Source Code  git master
simple_list.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SimpleOidListCell
 
struct  SimpleOidList
 
struct  SimpleStringListCell
 
struct  SimpleStringList
 
struct  SimplePtrListCell
 
struct  SimplePtrList
 

Typedefs

typedef struct SimpleOidListCell SimpleOidListCell
 
typedef struct SimpleOidList SimpleOidList
 
typedef struct SimpleStringListCell SimpleStringListCell
 
typedef struct SimpleStringList SimpleStringList
 
typedef struct SimplePtrListCell SimplePtrListCell
 
typedef struct SimplePtrList SimplePtrList
 

Functions

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

Typedef Documentation

◆ SimpleOidList

typedef struct SimpleOidList SimpleOidList

◆ SimpleOidListCell

◆ SimplePtrList

typedef struct SimplePtrList SimplePtrList

◆ SimplePtrListCell

◆ SimpleStringList

◆ SimpleStringListCell

Function Documentation

◆ simple_oid_list_append()

void simple_oid_list_append ( SimpleOidList list,
Oid  val 
)

Definition at line 26 of file simple_list.c.

References SimpleOidList::head, SimpleOidListCell::next, pg_malloc(), SimpleOidList::tail, SimpleOidListCell::val, and val.

Referenced by expand_schema_name_patterns(), and expand_table_name_patterns().

27 {
28  SimpleOidListCell *cell;
29 
30  cell = (SimpleOidListCell *) pg_malloc(sizeof(SimpleOidListCell));
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
SimpleOidListCell * tail
Definition: simple_list.h:29
struct SimpleOidListCell * next
Definition: simple_list.h:22
SimpleOidListCell * head
Definition: simple_list.h:28
long val
Definition: informix.c:664

◆ simple_oid_list_destroy()

void simple_oid_list_destroy ( SimpleOidList list)

Definition at line 106 of file simple_list.c.

References SimpleOidList::head, SimpleOidListCell::next, next, and pg_free().

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:213
struct SimpleOidListCell * next
Definition: simple_list.h:22
SimpleOidListCell * head
Definition: simple_list.h:28
void pg_free(void *ptr)
Definition: fe_memutils.c:105

◆ simple_oid_list_member()

bool simple_oid_list_member ( SimpleOidList list,
Oid  val 
)

Definition at line 45 of file simple_list.c.

References SimpleOidList::head, SimpleOidListCell::next, and SimpleOidListCell::val.

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

46 {
47  SimpleOidListCell *cell;
48 
49  for (cell = list->head; cell; cell = cell->next)
50  {
51  if (cell->val == val)
52  return true;
53  }
54  return false;
55 }
struct SimpleOidListCell * next
Definition: simple_list.h:22
SimpleOidListCell * head
Definition: simple_list.h:28
long val
Definition: informix.c:664

◆ simple_ptr_list_append()

void simple_ptr_list_append ( SimplePtrList list,
void *  val 
)

Definition at line 162 of file simple_list.c.

References SimplePtrList::head, SimplePtrListCell::next, pg_malloc(), SimplePtrListCell::ptr, and SimplePtrList::tail.

Referenced by flagInhIndexes().

163 {
164  SimplePtrListCell *cell;
165 
166  cell = (SimplePtrListCell *) pg_malloc(sizeof(SimplePtrListCell));
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 }
void * pg_malloc(size_t size)
Definition: fe_memutils.c:47
SimplePtrListCell * tail
Definition: simple_list.h:55
struct SimplePtrListCell * next
Definition: simple_list.h:48
SimplePtrListCell * head
Definition: simple_list.h:54

◆ simple_string_list_append()

void simple_string_list_append ( SimpleStringList list,
const char *  val 
)

Definition at line 63 of file simple_list.c.

References SimpleStringList::head, SimpleStringListCell::next, offsetof, pg_malloc(), SimpleStringList::tail, SimpleStringListCell::touched, and SimpleStringListCell::val.

Referenced by expand_dbname_patterns(), get_parallel_object_list(), main(), reindex_one_database(), and vacuum_one_database().

64 {
66 
67  cell = (SimpleStringListCell *)
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 }
void * pg_malloc(size_t size)
Definition: fe_memutils.c:47
SimpleStringListCell * tail
Definition: simple_list.h:43
struct SimpleStringListCell * next
Definition: simple_list.h:34
SimpleStringListCell * head
Definition: simple_list.h:42
char val[FLEXIBLE_ARRAY_MEMBER]
Definition: simple_list.h:37
long val
Definition: informix.c:664
#define offsetof(type, field)
Definition: c.h:662

◆ simple_string_list_destroy()

void simple_string_list_destroy ( SimpleStringList list)

Definition at line 125 of file simple_list.c.

References SimpleStringList::head, SimpleStringListCell::next, next, and pg_free().

Referenced by reindex_one_database().

126 {
127  SimpleStringListCell *cell;
128 
129  cell = list->head;
130  while (cell != NULL)
131  {
133 
134  next = cell->next;
135  pg_free(cell);
136  cell = next;
137  }
138 }
static int32 next
Definition: blutils.c:213
struct SimpleStringListCell * next
Definition: simple_list.h:34
SimpleStringListCell * head
Definition: simple_list.h:42
void pg_free(void *ptr)
Definition: fe_memutils.c:105

◆ simple_string_list_member()

bool simple_string_list_member ( SimpleStringList list,
const char *  val 
)

Definition at line 87 of file simple_list.c.

References SimpleStringList::head, SimpleStringListCell::next, SimpleStringListCell::touched, and SimpleStringListCell::val.

Referenced by _tocEntryRequired(), and dumpDatabases().

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 }
struct SimpleStringListCell * next
Definition: simple_list.h:34
SimpleStringListCell * head
Definition: simple_list.h:42
char val[FLEXIBLE_ARRAY_MEMBER]
Definition: simple_list.h:37
long val
Definition: informix.c:664

◆ simple_string_list_not_touched()

const char* simple_string_list_not_touched ( SimpleStringList list)

Definition at line 144 of file simple_list.c.

References SimpleStringList::head, SimpleStringListCell::next, SimpleStringListCell::touched, and SimpleStringListCell::val.

Referenced by StrictNamesCheck().

145 {
146  SimpleStringListCell *cell;
147 
148  for (cell = list->head; cell; cell = cell->next)
149  {
150  if (!cell->touched)
151  return cell->val;
152  }
153  return NULL;
154 }
struct SimpleStringListCell * next
Definition: simple_list.h:34
SimpleStringListCell * head
Definition: simple_list.h:42
char val[FLEXIBLE_ARRAY_MEMBER]
Definition: simple_list.h:37