代码拉取完成,页面将自动刷新
同步操作将从 IvorySQL/IvorySQL 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*-------------------------------------------------------------------------
*
* Simple list facilities for frontend code
*
* Data structures for simple lists of OIDs and strings. The support for
* these is very primitive compared to the backend's List facilities, but
* it's all we need in, eg, pg_dump.
*
*
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/fe_utils/simple_list.c
*
*-------------------------------------------------------------------------
*/
#include "postgres_fe.h"
#include "fe_utils/simple_list.h"
/*
* Append an OID to the list.
*/
void
simple_oid_list_append(SimpleOidList *list, Oid val)
{
SimpleOidListCell *cell;
cell = (SimpleOidListCell *) pg_malloc(sizeof(SimpleOidListCell));
cell->next = NULL;
cell->val = val;
if (list->tail)
list->tail->next = cell;
else
list->head = cell;
list->tail = cell;
}
/*
* Is OID present in the list?
*/
bool
simple_oid_list_member(SimpleOidList *list, Oid val)
{
SimpleOidListCell *cell;
for (cell = list->head; cell; cell = cell->next)
{
if (cell->val == val)
return true;
}
return false;
}
/*
* Append a string to the list.
*
* The given string is copied, so it need not survive past the call.
*/
void
simple_string_list_append(SimpleStringList *list, const char *val)
{
SimpleStringListCell *cell;
cell = (SimpleStringListCell *)
pg_malloc(offsetof(SimpleStringListCell, val) + strlen(val) + 1);
cell->next = NULL;
cell->touched = false;
strcpy(cell->val, val);
if (list->tail)
list->tail->next = cell;
else
list->head = cell;
list->tail = cell;
}
/*
* Is string present in the list?
*
* If found, the "touched" field of the first match is set true.
*/
bool
simple_string_list_member(SimpleStringList *list, const char *val)
{
SimpleStringListCell *cell;
for (cell = list->head; cell; cell = cell->next)
{
if (strcmp(cell->val, val) == 0)
{
cell->touched = true;
return true;
}
}
return false;
}
/*
* Destroy an OID list
*/
void
simple_oid_list_destroy(SimpleOidList *list)
{
SimpleOidListCell *cell;
cell = list->head;
while (cell != NULL)
{
SimpleOidListCell *next;
next = cell->next;
pg_free(cell);
cell = next;
}
}
/*
* Destroy a string list
*/
void
simple_string_list_destroy(SimpleStringList *list)
{
SimpleStringListCell *cell;
cell = list->head;
while (cell != NULL)
{
SimpleStringListCell *next;
next = cell->next;
pg_free(cell);
cell = next;
}
}
/*
* Find first not-touched list entry, if there is one.
*/
const char *
simple_string_list_not_touched(SimpleStringList *list)
{
SimpleStringListCell *cell;
for (cell = list->head; cell; cell = cell->next)
{
if (!cell->touched)
return cell->val;
}
return NULL;
}
/*
* Append a pointer to the list.
*
* Caller must ensure that the pointer remains valid.
*/
void
simple_ptr_list_append(SimplePtrList *list, void *ptr)
{
SimplePtrListCell *cell;
cell = (SimplePtrListCell *) pg_malloc(sizeof(SimplePtrListCell));
cell->next = NULL;
cell->ptr = ptr;
if (list->tail)
list->tail->next = cell;
else
list->head = cell;
list->tail = cell;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。