codekingpro/portable-devtools
115k
1/*-------------------------------------------------------------------------2 *3 * Simple list facilities for frontend code4 *5 * Data structures for simple lists of OIDs, strings, and pointers. The6 * support for these is very primitive compared to the backend's List7 * facilities, but it's all we need in, eg, pg_dump.8 *9 *10 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group11 * Portions Copyright (c) 1994, Regents of the University of California12 *13 * src/include/fe_utils/simple_list.h14 *15 *-------------------------------------------------------------------------16 */17#ifndef SIMPLE_LIST_H18#define SIMPLE_LIST_H19 20typedef struct SimpleOidListCell21{22 struct SimpleOidListCell *next;23 Oid val;24} SimpleOidListCell;25 26typedef struct SimpleOidList27{28 SimpleOidListCell *head;29 SimpleOidListCell *tail;30} SimpleOidList;31 32typedef struct SimpleStringListCell33{34 struct SimpleStringListCell *next;35 bool touched; /* true, when this string was searched and36 * touched */37 char val[FLEXIBLE_ARRAY_MEMBER]; /* null-terminated string here */38} SimpleStringListCell;39 40typedef struct SimpleStringList41{42 SimpleStringListCell *head;43 SimpleStringListCell *tail;44} SimpleStringList;45 46typedef struct SimplePtrListCell47{48 struct SimplePtrListCell *next;49 void *ptr;50} SimplePtrListCell;51 52typedef struct SimplePtrList53{54 SimplePtrListCell *head;55 SimplePtrListCell *tail;56} SimplePtrList;57 58extern void simple_oid_list_append(SimpleOidList *list, Oid val);59extern bool simple_oid_list_member(SimpleOidList *list, Oid val);60extern void simple_oid_list_destroy(SimpleOidList *list);61 62extern void simple_string_list_append(SimpleStringList *list, const char *val);63extern bool simple_string_list_member(SimpleStringList *list, const char *val);64extern void simple_string_list_destroy(SimpleStringList *list);65 66extern const char *simple_string_list_not_touched(SimpleStringList *list);67 68extern void simple_ptr_list_append(SimplePtrList *list, void *ptr);69 70#endif /* SIMPLE_LIST_H */71 