Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2b69afb

Browse files
committed
add new list type simple_oid_string_list to fe-utils/simple_list
This type contains both an oid and a string.This will be used in forthcoming changes to pg_restore.Author: Andrew Dunstan <andrew@dunslane.net>
1 parentc1da728 commit2b69afb

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

‎src/fe_utils/simple_list.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff 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,Oidoid,constchar*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+
}

‎src/include/fe_utils/simple_list.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ typedef struct SimplePtrList
5555
SimplePtrListCell*tail;
5656
}SimplePtrList;
5757

58+
typedefstructSimpleOidStringListCell
59+
{
60+
structSimpleOidStringListCell*next;
61+
Oidoid;
62+
charstr[FLEXIBLE_ARRAY_MEMBER];/* null-terminated string here */
63+
}SimpleOidStringListCell;
64+
65+
typedefstructSimpleOidStringList
66+
{
67+
SimpleOidStringListCell*head;
68+
SimpleOidStringListCell*tail;
69+
}SimpleOidStringList;
70+
5871
externvoidsimple_oid_list_append(SimpleOidList*list,Oidval);
5972
externboolsimple_oid_list_member(SimpleOidList*list,Oidval);
6073
externvoidsimple_oid_list_destroy(SimpleOidList*list);
@@ -68,4 +81,7 @@ extern const char *simple_string_list_not_touched(SimpleStringList *list);
6881
externvoidsimple_ptr_list_append(SimplePtrList*list,void*ptr);
6982
externvoidsimple_ptr_list_destroy(SimplePtrList*list);
7083

84+
externvoidsimple_oid_string_list_append(SimpleOidStringList*list,Oidoid,constchar*str);
85+
externvoidsimple_oid_string_list_destroy(SimpleOidStringList*list);
86+
7187
#endif/* SIMPLE_LIST_H */

‎src/tools/pgindent/typedefs.list

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,6 +2747,8 @@ SimpleActionListCell
27472747
SimpleEcontextStackEntry
27482748
SimpleOidList
27492749
SimpleOidListCell
2750+
SimpleOidStringList
2751+
SimpleOidListStringCell
27502752
SimplePtrList
27512753
SimplePtrListCell
27522754
SimpleStats

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp