File tree 3 files changed +59
-0
lines changed
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)
192
192
cell = next ;
193
193
}
194
194
}
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
55
55
SimplePtrListCell * tail ;
56
56
} SimplePtrList ;
57
57
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
+
58
71
extern void simple_oid_list_append (SimpleOidList * list , Oid val );
59
72
extern bool simple_oid_list_member (SimpleOidList * list , Oid val );
60
73
extern void simple_oid_list_destroy (SimpleOidList * list );
@@ -68,4 +81,7 @@ extern const char *simple_string_list_not_touched(SimpleStringList *list);
68
81
extern void simple_ptr_list_append (SimplePtrList * list , void * ptr );
69
82
extern void simple_ptr_list_destroy (SimplePtrList * list );
70
83
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
+
71
87
#endif /* SIMPLE_LIST_H */
Original file line number Diff line number Diff line change @@ -2747,6 +2747,8 @@ SimpleActionListCell
2747
2747
SimpleEcontextStackEntry
2748
2748
SimpleOidList
2749
2749
SimpleOidListCell
2750
+ SimpleOidStringList
2751
+ SimpleOidListStringCell
2750
2752
SimplePtrList
2751
2753
SimplePtrListCell
2752
2754
SimpleStats
You can’t perform that action at this time.
0 commit comments