PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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)
 
const char * simple_string_list_not_touched (SimpleStringList *list)
 

Function Documentation

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:689
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:689
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 main(), 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:689
#define offsetof(type, field)
Definition: c.h:549
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().

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:689
const char* simple_string_list_not_touched ( SimpleStringList list)

Definition at line 106 of file simple_list.c.

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

Referenced by StrictNamesCheck().

107 {
108  SimpleStringListCell *cell;
109 
110  for (cell = list->head; cell; cell = cell->next)
111  {
112  if (!cell->touched)
113  return cell->val;
114  }
115  return NULL;
116 }
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