File tree Expand file tree Collapse file tree 3 files changed +59
-0
lines changed
Expand file tree Collapse file tree 3 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -192,3 +192,44 @@ simple_ptr_list_destroy(SimplePtrList *list)
192192 cell = next ;
193193 }
194194}
195+
196+ /*
197+ * Add to an oid_string list
198+ */
199+ void
200+ simple_oid_string_list_append (SimpleOidStringList * list , Oid oid , const char * str )
201+ {
202+ SimpleOidStringListCell * cell ;
203+
204+ cell = (SimpleOidStringListCell * )
205+ pg_malloc (offsetof(SimpleOidStringListCell , str ) + strlen (str ) + 1 );
206+
207+ cell -> next = NULL ;
208+ cell -> oid = oid ;
209+ strcpy (cell -> str , str );
210+
211+ if (list -> tail )
212+ list -> tail -> next = cell ;
213+ else
214+ list -> head = cell ;
215+ list -> tail = cell ;
216+ }
217+
218+ /*
219+ * Destroy an oid_string list
220+ */
221+ void
222+ simple_oid_string_list_destroy (SimpleOidStringList * list )
223+ {
224+ SimpleOidStringListCell * cell ;
225+
226+ cell = list -> head ;
227+ while (cell != NULL )
228+ {
229+ SimpleOidStringListCell * next ;
230+
231+ next = cell -> next ;
232+ pg_free (cell );
233+ cell = next ;
234+ }
235+ }
Original file line number Diff line number Diff line change @@ -55,6 +55,19 @@ typedef struct SimplePtrList
5555 SimplePtrListCell * tail ;
5656} SimplePtrList ;
5757
58+ typedef struct SimpleOidStringListCell
59+ {
60+ struct SimpleOidStringListCell * next ;
61+ Oid oid ;
62+ char str [FLEXIBLE_ARRAY_MEMBER ]; /* null-terminated string here */
63+ } SimpleOidStringListCell ;
64+
65+ typedef struct SimpleOidStringList
66+ {
67+ SimpleOidStringListCell * head ;
68+ SimpleOidStringListCell * tail ;
69+ } SimpleOidStringList ;
70+
5871extern void simple_oid_list_append (SimpleOidList * list , Oid val );
5972extern bool simple_oid_list_member (SimpleOidList * list , Oid val );
6073extern void simple_oid_list_destroy (SimpleOidList * list );
@@ -68,4 +81,7 @@ extern const char *simple_string_list_not_touched(SimpleStringList *list);
6881extern void simple_ptr_list_append (SimplePtrList * list , void * ptr );
6982extern void simple_ptr_list_destroy (SimplePtrList * list );
7083
84+ extern void simple_oid_string_list_append (SimpleOidStringList * list , Oid oid , const char * str );
85+ extern void simple_oid_string_list_destroy (SimpleOidStringList * list );
86+
7187#endif /* SIMPLE_LIST_H */
Original file line number Diff line number Diff line change @@ -2747,6 +2747,8 @@ SimpleActionListCell
27472747SimpleEcontextStackEntry
27482748SimpleOidList
27492749SimpleOidListCell
2750+ SimpleOidStringList
2751+ SimpleOidListStringCell
27502752SimplePtrList
27512753SimplePtrListCell
27522754SimpleStats
You can’t perform that action at this time.
0 commit comments