PostgreSQL Source Code  git master
ilist.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dlist_node
 
struct  dlist_head
 
struct  dlist_iter
 
struct  dlist_mutable_iter
 
struct  dclist_head
 
struct  slist_node
 
struct  slist_head
 
struct  slist_iter
 
struct  slist_mutable_iter
 

Macros

#define DLIST_STATIC_INIT(name)   {{&(name).head, &(name).head}}
 
#define DCLIST_STATIC_INIT(name)   {{{&(name).dlist.head, &(name).dlist.head}}, 0}
 
#define SLIST_STATIC_INIT(name)   {{NULL}}
 
#define dlist_member_check(head, node)   ((void) (head))
 
#define dlist_check(head)   ((void) (head))
 
#define slist_check(head)   ((void) (head))
 
#define dlist_container(type, membername, ptr)
 
#define dlist_head_element(type, membername, lhead)
 
#define dlist_tail_element(type, membername, lhead)
 
#define dlist_foreach(iter, lhead)
 
#define dlist_foreach_modify(iter, lhead)
 
#define dlist_reverse_foreach(iter, lhead)
 
#define dclist_container(type, membername, ptr)    dlist_container(type, membername, ptr)
 
#define dclist_head_element(type, membername, lhead)
 
#define dclist_tail_element(type, membername, lhead)
 
#define dclist_foreach(iter, lhead)    dlist_foreach(iter, &((lhead)->dlist))
 
#define dclist_foreach_modify(iter, lhead)    dlist_foreach_modify(iter, &((lhead)->dlist))
 
#define dclist_reverse_foreach(iter, lhead)    dlist_reverse_foreach(iter, &((lhead)->dlist))
 
#define slist_container(type, membername, ptr)
 
#define slist_head_element(type, membername, lhead)
 
#define slist_foreach(iter, lhead)
 
#define slist_foreach_modify(iter, lhead)
 

Typedefs

typedef struct dlist_node dlist_node
 
typedef struct dlist_head dlist_head
 
typedef struct dlist_iter dlist_iter
 
typedef struct dlist_mutable_iter dlist_mutable_iter
 
typedef struct dclist_head dclist_head
 
typedef struct slist_node slist_node
 
typedef struct slist_head slist_head
 
typedef struct slist_iter slist_iter
 
typedef struct slist_mutable_iter slist_mutable_iter
 

Functions

void slist_delete (slist_head *head, const slist_node *node)
 
static void dlist_init (dlist_head *head)
 
static void dlist_node_init (dlist_node *node)
 
static bool dlist_is_empty (const dlist_head *head)
 
static void dlist_push_head (dlist_head *head, dlist_node *node)
 
static void dlist_push_tail (dlist_head *head, dlist_node *node)
 
static void dlist_insert_after (dlist_node *after, dlist_node *node)
 
static void dlist_insert_before (dlist_node *before, dlist_node *node)
 
static void dlist_delete (dlist_node *node)
 
static void dlist_delete_thoroughly (dlist_node *node)
 
static void dlist_delete_from (dlist_head *head, dlist_node *node)
 
static void dlist_delete_from_thoroughly (dlist_head *head, dlist_node *node)
 
static dlist_nodedlist_pop_head_node (dlist_head *head)
 
static void dlist_move_head (dlist_head *head, dlist_node *node)
 
static void dlist_move_tail (dlist_head *head, dlist_node *node)
 
static bool dlist_has_next (const dlist_head *head, const dlist_node *node)
 
static bool dlist_has_prev (const dlist_head *head, const dlist_node *node)
 
static bool dlist_node_is_detached (const dlist_node *node)
 
static dlist_nodedlist_next_node (dlist_head *head, dlist_node *node)
 
static dlist_nodedlist_prev_node (dlist_head *head, dlist_node *node)
 
static void * dlist_head_element_off (dlist_head *head, size_t off)
 
static dlist_nodedlist_head_node (dlist_head *head)
 
static void * dlist_tail_element_off (dlist_head *head, size_t off)
 
static dlist_nodedlist_tail_node (dlist_head *head)
 
static void dclist_init (dclist_head *head)
 
static bool dclist_is_empty (const dclist_head *head)
 
static void dclist_push_head (dclist_head *head, dlist_node *node)
 
static void dclist_push_tail (dclist_head *head, dlist_node *node)
 
static void dclist_insert_after (dclist_head *head, dlist_node *after, dlist_node *node)
 
static void dclist_insert_before (dclist_head *head, dlist_node *before, dlist_node *node)
 
static void dclist_delete_from (dclist_head *head, dlist_node *node)
 
static void dclist_delete_from_thoroughly (dclist_head *head, dlist_node *node)
 
static dlist_nodedclist_pop_head_node (dclist_head *head)
 
static void dclist_move_head (dclist_head *head, dlist_node *node)
 
static void dclist_move_tail (dclist_head *head, dlist_node *node)
 
static bool dclist_has_next (const dclist_head *head, const dlist_node *node)
 
static bool dclist_has_prev (const dclist_head *head, const dlist_node *node)
 
static dlist_nodedclist_next_node (dclist_head *head, dlist_node *node)
 
static dlist_nodedclist_prev_node (dclist_head *head, dlist_node *node)
 
static void * dclist_head_element_off (dclist_head *head, size_t off)
 
static dlist_nodedclist_head_node (dclist_head *head)
 
static void * dclist_tail_element_off (dclist_head *head, size_t off)
 
static dlist_nodedclist_tail_node (dclist_head *head)
 
static uint32 dclist_count (const dclist_head *head)
 
static void slist_init (slist_head *head)
 
static bool slist_is_empty (const slist_head *head)
 
static void slist_push_head (slist_head *head, slist_node *node)
 
static void slist_insert_after (slist_node *after, slist_node *node)
 
static slist_nodeslist_pop_head_node (slist_head *head)
 
static bool slist_has_next (const slist_head *head, const slist_node *node)
 
static slist_nodeslist_next_node (slist_head *head, slist_node *node)
 
static void * slist_head_element_off (slist_head *head, size_t off)
 
static slist_nodeslist_head_node (slist_head *head)
 
static void slist_delete_current (slist_mutable_iter *iter)
 

Macro Definition Documentation

◆ dclist_container

#define dclist_container (   type,
  membername,
  ptr 
)     dlist_container(type, membername, ptr)

Definition at line 947 of file ilist.h.

◆ dclist_foreach

#define dclist_foreach (   iter,
  lhead 
)     dlist_foreach(iter, &((lhead)->dlist))

Definition at line 970 of file ilist.h.

◆ dclist_foreach_modify

#define dclist_foreach_modify (   iter,
  lhead 
)     dlist_foreach_modify(iter, &((lhead)->dlist))

Definition at line 973 of file ilist.h.

◆ dclist_head_element

#define dclist_head_element (   type,
  membername,
  lhead 
)
Value:
(AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \
(type *) dclist_head_element_off(lhead, offsetof(type, membername)))
#define AssertVariableIsOfTypeMacro(varname, typename)
Definition: c.h:938
static void * dclist_head_element_off(dclist_head *head, size_t off)
Definition: ilist.h:888
const char * type

Definition at line 955 of file ilist.h.

◆ dclist_reverse_foreach

#define dclist_reverse_foreach (   iter,
  lhead 
)     dlist_reverse_foreach(iter, &((lhead)->dlist))

Definition at line 976 of file ilist.h.

◆ DCLIST_STATIC_INIT

#define DCLIST_STATIC_INIT (   name)    {{{&(name).dlist.head, &(name).dlist.head}}, 0}

Definition at line 282 of file ilist.h.

◆ dclist_tail_element

#define dclist_tail_element (   type,
  membername,
  lhead 
)
Value:
(AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \
((type *) dclist_tail_element_off(lhead, offsetof(type, membername))))
static void * dclist_tail_element_off(dclist_head *head, size_t off)
Definition: ilist.h:909

Definition at line 964 of file ilist.h.

◆ dlist_check

#define dlist_check (   head)    ((void) (head))

Definition at line 303 of file ilist.h.

◆ dlist_container

#define dlist_container (   type,
  membername,
  ptr 
)
Value:
AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \
((type *) ((char *) (ptr) - offsetof(type, membername))))

Definition at line 593 of file ilist.h.

◆ dlist_foreach

#define dlist_foreach (   iter,
  lhead 
)
Value:
(iter).end = &(lhead)->head, \
(iter).cur = (iter).end->next ? (iter).end->next : (iter).end; \
(iter).cur != (iter).end; \
(iter).cur = (iter).cur->next)
struct cursor * cur
Definition: ecpg.c:29
struct cursor * next
Definition: type.h:148

Definition at line 623 of file ilist.h.

◆ dlist_foreach_modify

#define dlist_foreach_modify (   iter,
  lhead 
)
Value:
(iter).end = &(lhead)->head, \
(iter).cur = (iter).end->next ? (iter).end->next : (iter).end, \
(iter).next = (iter).cur->next; \
(iter).cur != (iter).end; \
(iter).cur = (iter).next, (iter).next = (iter).cur->next)

Definition at line 640 of file ilist.h.

◆ dlist_head_element

#define dlist_head_element (   type,
  membername,
  lhead 
)
Value:
(AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \
(type *) dlist_head_element_off(lhead, offsetof(type, membername)))
static void * dlist_head_element_off(dlist_head *head, size_t off)
Definition: ilist.h:555

Definition at line 603 of file ilist.h.

◆ dlist_member_check

#define dlist_member_check (   head,
  node 
)    ((void) (head))

Definition at line 302 of file ilist.h.

◆ dlist_reverse_foreach

#define dlist_reverse_foreach (   iter,
  lhead 
)
Value:
(iter).end = &(lhead)->head, \
(iter).cur = (iter).end->prev ? (iter).end->prev : (iter).end; \
(iter).cur != (iter).end; \
(iter).cur = (iter).cur->prev)

Definition at line 654 of file ilist.h.

◆ DLIST_STATIC_INIT

#define DLIST_STATIC_INIT (   name)    {{&(name).head, &(name).head}}

Definition at line 281 of file ilist.h.

◆ dlist_tail_element

#define dlist_tail_element (   type,
  membername,
  lhead 
)
Value:
(AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node), \
((type *) dlist_tail_element_off(lhead, offsetof(type, membername))))
static void * dlist_tail_element_off(dlist_head *head, size_t off)
Definition: ilist.h:572

Definition at line 612 of file ilist.h.

◆ slist_check

#define slist_check (   head)    ((void) (head))

Definition at line 304 of file ilist.h.

◆ slist_container

#define slist_container (   type,
  membername,
  ptr 
)
Value:
AssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \
((type *) ((char *) (ptr) - offsetof(type, membername))))

Definition at line 1106 of file ilist.h.

◆ slist_foreach

#define slist_foreach (   iter,
  lhead 
)
Value:
(iter).cur = (lhead)->head.next; \
(iter).cur != NULL; \
(iter).cur = (iter).cur->next)

Definition at line 1132 of file ilist.h.

◆ slist_foreach_modify

#define slist_foreach_modify (   iter,
  lhead 
)
Value:
(iter).prev = &(lhead)->head, \
(iter).cur = (iter).prev->next, \
(iter).next = (iter).cur ? (iter).cur->next : NULL; \
(iter).cur != NULL; \
(iter).prev = (iter).cur, \
(iter).cur = (iter).next, \
(iter).next = (iter).next ? (iter).next->next : NULL)

Definition at line 1148 of file ilist.h.

◆ slist_head_element

#define slist_head_element (   type,
  membername,
  lhead 
)
Value:
(AssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \
(type *) slist_head_element_off(lhead, offsetof(type, membername)))
static void * slist_head_element_off(slist_head *head, size_t off)
Definition: ilist.h:1062

Definition at line 1116 of file ilist.h.

◆ SLIST_STATIC_INIT

#define SLIST_STATIC_INIT (   name)    {{NULL}}

Definition at line 283 of file ilist.h.

Typedef Documentation

◆ dclist_head

typedef struct dclist_head dclist_head

◆ dlist_head

typedef struct dlist_head dlist_head

◆ dlist_iter

typedef struct dlist_iter dlist_iter

◆ dlist_mutable_iter

◆ dlist_node

typedef struct dlist_node dlist_node

Definition at line 1 of file ilist.h.

◆ slist_head

typedef struct slist_head slist_head

◆ slist_iter

typedef struct slist_iter slist_iter

◆ slist_mutable_iter

◆ slist_node

typedef struct slist_node slist_node

Definition at line 1 of file ilist.h.

Function Documentation

◆ dclist_count()

static uint32 dclist_count ( const dclist_head head)
inlinestatic

◆ dclist_delete_from()

static void dclist_delete_from ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 763 of file ilist.h.

764 {
765  Assert(head->count > 0);
766 
767  dlist_delete_from(&head->dlist, node);
768  head->count--;
769 }
static void dlist_delete_from(dlist_head *head, dlist_node *node)
Definition: ilist.h:429

References Assert, dclist_head::count, dclist_head::dlist, and dlist_delete_from().

Referenced by AtEOSubXact_PgStat_DroppedStats(), AtEOXact_PgStat_DroppedStats(), InvalidateConstraintCacheCallBack(), logical_heap_rewrite_flush_mappings(), mXactCachePut(), ReorderBufferCleanupTXN(), and SlabReset().

◆ dclist_delete_from_thoroughly()

static void dclist_delete_from_thoroughly ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 776 of file ilist.h.

777 {
778  Assert(head->count > 0);
779 
780  dlist_delete_from_thoroughly(&head->dlist, node);
781  head->count--;
782 }
static void dlist_delete_from_thoroughly(dlist_head *head, dlist_node *node)
Definition: ilist.h:440

References Assert, dclist_head::count, dclist_head::dlist, and dlist_delete_from_thoroughly().

Referenced by ProcWakeup(), and RemoveFromWaitQueue().

◆ dclist_has_next()

static bool dclist_has_next ( const dclist_head head,
const dlist_node node 
)
inlinestatic

Definition at line 839 of file ilist.h.

840 {
841  dlist_member_check(&head->dlist, node);
842  Assert(head->count > 0);
843 
844  return dlist_has_next(&head->dlist, node);
845 }
static bool dlist_has_next(const dlist_head *head, const dlist_node *node)
Definition: ilist.h:503
#define dlist_member_check(head, node)
Definition: ilist.h:302

References Assert, dclist_head::count, dclist_head::dlist, dlist_has_next(), and dlist_member_check.

◆ dclist_has_prev()

static bool dclist_has_prev ( const dclist_head head,
const dlist_node node 
)
inlinestatic

Definition at line 854 of file ilist.h.

855 {
856  dlist_member_check(&head->dlist, node);
857  Assert(head->count > 0);
858 
859  return dlist_has_prev(&head->dlist, node);
860 }
static bool dlist_has_prev(const dlist_head *head, const dlist_node *node)
Definition: ilist.h:513

References Assert, dclist_head::count, dclist_head::dlist, dlist_has_prev(), and dlist_member_check.

◆ dclist_head_element_off()

static void* dclist_head_element_off ( dclist_head head,
size_t  off 
)
inlinestatic

Definition at line 888 of file ilist.h.

889 {
890  Assert(!dclist_is_empty(head));
891 
892  return (char *) head->dlist.head.next - off;
893 }
static bool dclist_is_empty(const dclist_head *head)
Definition: ilist.h:682
dlist_node head
Definition: ilist.h:160
dlist_node * next
Definition: ilist.h:140

References Assert, dclist_is_empty(), dclist_head::dlist, dlist_head::head, and dlist_node::next.

◆ dclist_head_node()

static dlist_node* dclist_head_node ( dclist_head head)
inlinestatic

Definition at line 900 of file ilist.h.

901 {
902  Assert(head->count > 0);
903 
904  return (dlist_node *) dlist_head_element_off(&head->dlist, 0);
905 }

References Assert, dclist_head::count, dclist_head::dlist, and dlist_head_element_off().

◆ dclist_init()

static void dclist_init ( dclist_head head)
inlinestatic

◆ dclist_insert_after()

static void dclist_insert_after ( dclist_head head,
dlist_node after,
dlist_node node 
)
inlinestatic

Definition at line 727 of file ilist.h.

728 {
729  dlist_member_check(&head->dlist, after);
730  Assert(head->count > 0); /* must be at least 1 already */
731 
732  dlist_insert_after(after, node);
733  head->count++;
734 
735  Assert(head->count > 0); /* count overflow check */
736 }
static void dlist_insert_after(dlist_node *after, dlist_node *node)
Definition: ilist.h:381

References Assert, dclist_head::count, dclist_head::dlist, dlist_insert_after(), and dlist_member_check.

◆ dclist_insert_before()

static void dclist_insert_before ( dclist_head head,
dlist_node before,
dlist_node node 
)
inlinestatic

Definition at line 745 of file ilist.h.

746 {
748  Assert(head->count > 0); /* must be at least 1 already */
749 
751  head->count++;
752 
753  Assert(head->count > 0); /* count overflow check */
754 }
static void dlist_insert_before(dlist_node *before, dlist_node *node)
Definition: ilist.h:393
static int before(chr x, chr y)
Definition: regc_locale.c:488

References Assert, before(), dclist_head::count, dclist_head::dlist, dlist_insert_before(), and dlist_member_check.

Referenced by JoinWaitQueue().

◆ dclist_is_empty()

static bool dclist_is_empty ( const dclist_head head)
inlinestatic

Definition at line 682 of file ilist.h.

683 {
684  Assert(dlist_is_empty(&head->dlist) == (head->count == 0));
685  return (head->count == 0);
686 }

References Assert, dclist_head::count, dclist_head::dlist, and dlist_is_empty().

Referenced by dclist_head_element_off(), dclist_tail_element_off(), JoinWaitQueue(), ProcLockWakeup(), and RemoveFromWaitQueue().

◆ dclist_move_head()

static void dclist_move_head ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 808 of file ilist.h.

809 {
810  dlist_member_check(&head->dlist, node);
811  Assert(head->count > 0);
812 
813  dlist_move_head(&head->dlist, node);
814 }
static void dlist_move_head(dlist_head *head, dlist_node *node)
Definition: ilist.h:467

References Assert, dclist_head::count, dclist_head::dlist, dlist_member_check, and dlist_move_head().

Referenced by mXactCacheGetById(), and mXactCacheGetBySet().

◆ dclist_move_tail()

static void dclist_move_tail ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 824 of file ilist.h.

825 {
826  dlist_member_check(&head->dlist, node);
827  Assert(head->count > 0);
828 
829  dlist_move_tail(&head->dlist, node);
830 }
static void dlist_move_tail(dlist_head *head, dlist_node *node)
Definition: ilist.h:486

References Assert, dclist_head::count, dclist_head::dlist, dlist_member_check, and dlist_move_tail().

◆ dclist_next_node()

static dlist_node* dclist_next_node ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 867 of file ilist.h.

868 {
869  Assert(head->count > 0);
870 
871  return dlist_next_node(&head->dlist, node);
872 }
static dlist_node * dlist_next_node(dlist_head *head, dlist_node *node)
Definition: ilist.h:537

References Assert, dclist_head::count, dclist_head::dlist, and dlist_next_node().

◆ dclist_pop_head_node()

static dlist_node* dclist_pop_head_node ( dclist_head head)
inlinestatic

Definition at line 789 of file ilist.h.

790 {
791  dlist_node *node;
792 
793  Assert(head->count > 0);
794 
795  node = dlist_pop_head_node(&head->dlist);
796  head->count--;
797  return node;
798 }
static dlist_node * dlist_pop_head_node(dlist_head *head)
Definition: ilist.h:450

References Assert, dclist_head::count, dclist_head::dlist, and dlist_pop_head_node().

Referenced by SlabAllocFromNewBlock().

◆ dclist_prev_node()

static dlist_node* dclist_prev_node ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 879 of file ilist.h.

880 {
881  Assert(head->count > 0);
882 
883  return dlist_prev_node(&head->dlist, node);
884 }
static dlist_node * dlist_prev_node(dlist_head *head, dlist_node *node)
Definition: ilist.h:547

References Assert, dclist_head::count, dclist_head::dlist, and dlist_prev_node().

◆ dclist_push_head()

static void dclist_push_head ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 693 of file ilist.h.

694 {
695  if (head->dlist.head.next == NULL) /* convert NULL header to circular */
696  dclist_init(head);
697 
698  dlist_push_head(&head->dlist, node);
699  head->count++;
700 
701  Assert(head->count > 0); /* count overflow check */
702 }
static void dlist_push_head(dlist_head *head, dlist_node *node)
Definition: ilist.h:347
static void dclist_init(dclist_head *head)
Definition: ilist.h:671

References Assert, dclist_head::count, dclist_init(), dclist_head::dlist, dlist_push_head(), dlist_head::head, and dlist_node::next.

Referenced by mXactCachePut(), and SlabFree().

◆ dclist_push_tail()

static void dclist_push_tail ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 709 of file ilist.h.

710 {
711  if (head->dlist.head.next == NULL) /* convert NULL header to circular */
712  dclist_init(head);
713 
714  dlist_push_tail(&head->dlist, node);
715  head->count++;
716 
717  Assert(head->count > 0); /* count overflow check */
718 }
static void dlist_push_tail(dlist_head *head, dlist_node *node)
Definition: ilist.h:364

References Assert, dclist_head::count, dclist_init(), dclist_head::dlist, dlist_push_tail(), dlist_head::head, and dlist_node::next.

Referenced by AtEOSubXact_PgStat_DroppedStats(), create_drop_transactional_internal(), DeadLockCheck(), JoinWaitQueue(), logical_rewrite_log_mapping(), ReorderBufferXidSetCatalogChanges(), and ri_LoadConstraintInfo().

◆ dclist_tail_element_off()

static void* dclist_tail_element_off ( dclist_head head,
size_t  off 
)
inlinestatic

Definition at line 909 of file ilist.h.

910 {
911  Assert(!dclist_is_empty(head));
912 
913  return (char *) head->dlist.head.prev - off;
914 }
dlist_node * prev
Definition: ilist.h:139

References Assert, dclist_is_empty(), dclist_head::dlist, dlist_head::head, and dlist_node::prev.

◆ dclist_tail_node()

static dlist_node* dclist_tail_node ( dclist_head head)
inlinestatic

Definition at line 920 of file ilist.h.

921 {
922  Assert(head->count > 0);
923 
924  return (dlist_node *) dlist_tail_element_off(&head->dlist, 0);
925 }

References Assert, dclist_head::count, dclist_head::dlist, and dlist_tail_element_off().

Referenced by mXactCachePut().

◆ dlist_delete()

static void dlist_delete ( dlist_node node)
inlinestatic

◆ dlist_delete_from()

static void dlist_delete_from ( dlist_head head,
dlist_node node 
)
inlinestatic

Definition at line 429 of file ilist.h.

430 {
431  dlist_member_check(head, node);
432  dlist_delete(node);
433 }
static void dlist_delete(dlist_node *node)
Definition: ilist.h:405

References dlist_delete(), and dlist_member_check.

Referenced by dclist_delete_from(), SlabAlloc(), and SlabFree().

◆ dlist_delete_from_thoroughly()

static void dlist_delete_from_thoroughly ( dlist_head head,
dlist_node node 
)
inlinestatic

Definition at line 440 of file ilist.h.

441 {
442  dlist_member_check(head, node);
444 }
static void dlist_delete_thoroughly(dlist_node *node)
Definition: ilist.h:416

References dlist_delete_thoroughly(), and dlist_member_check.

Referenced by dclist_delete_from_thoroughly().

◆ dlist_delete_thoroughly()

static void dlist_delete_thoroughly ( dlist_node node)
inlinestatic

Definition at line 416 of file ilist.h.

417 {
418  node->prev->next = node->next;
419  node->next->prev = node->prev;
420  node->next = NULL;
421  node->prev = NULL;
422 }

References dlist_node::next, and dlist_node::prev.

Referenced by ClearOldPredicateLocks(), dlist_delete_from_thoroughly(), SummarizeOldestCommittedSxact(), SyncRepCancelWait(), SyncRepCleanupAtProcExit(), and SyncRepWakeQueue().

◆ dlist_has_next()

static bool dlist_has_next ( const dlist_head head,
const dlist_node node 
)
inlinestatic

◆ dlist_has_prev()

static bool dlist_has_prev ( const dlist_head head,
const dlist_node node 
)
inlinestatic

Definition at line 513 of file ilist.h.

514 {
515  return node->prev != &head->head;
516 }

References dlist_head::head, and dlist_node::prev.

Referenced by dataBeginPlaceToPageLeaf(), dclist_has_prev(), and dlist_prev_node().

◆ dlist_head_element_off()

static void* dlist_head_element_off ( dlist_head head,
size_t  off 
)
inlinestatic

Definition at line 555 of file ilist.h.

556 {
557  Assert(!dlist_is_empty(head));
558  return (char *) head->head.next - off;
559 }

References Assert, dlist_is_empty(), dlist_head::head, and dlist_node::next.

Referenced by dclist_head_node(), and dlist_head_node().

◆ dlist_head_node()

static dlist_node* dlist_head_node ( dlist_head head)
inlinestatic

◆ dlist_init()

◆ dlist_insert_after()

static void dlist_insert_after ( dlist_node after,
dlist_node node 
)
inlinestatic

Definition at line 381 of file ilist.h.

382 {
383  node->prev = after;
384  node->next = after->next;
385  after->next = node;
386  node->next->prev = node;
387 }

References dlist_node::next, and dlist_node::prev.

Referenced by dclist_insert_after(), leafRepackItems(), and SyncRepQueueInsert().

◆ dlist_insert_before()

static void dlist_insert_before ( dlist_node before,
dlist_node node 
)
inlinestatic

Definition at line 393 of file ilist.h.

394 {
395  node->prev = before->prev;
396  node->next = before;
397  before->prev = node;
398  node->prev->next = node;
399 }

References before(), dlist_node::next, and dlist_node::prev.

Referenced by dclist_insert_before(), and ReorderBufferTransferSnapToParent().

◆ dlist_is_empty()

static bool dlist_is_empty ( const dlist_head head)
inlinestatic

Definition at line 336 of file ilist.h.

337 {
338  dlist_check(head);
339 
340  return head->head.next == NULL || head->head.next == &(head->head);
341 }
#define dlist_check(head)
Definition: ilist.h:303

References dlist_check, dlist_head::head, and dlist_node::next.

Referenced by addItemsToLeaf(), AssignPostmasterChildSlot(), AtEOSubXact_Parallel(), AtEOXact_Parallel(), BumpReset(), CheckForSerializableConflictOut(), CleanUpLock(), CreatePredXact(), dataBeginPlaceToPageLeaf(), dclist_count(), dclist_is_empty(), dlist_head_element_off(), dlist_pop_head_node(), dlist_tail_element_off(), do_start_worker(), dsm_backend_shutdown(), dsm_detach_all(), ForgetManyTestResources(), GenerationReset(), get_flush_position(), GetSafeSnapshot(), GetSerializableTransactionSnapshotInt(), InitAuxiliaryProcess(), InitProcess(), launcher_determine_sleep(), lock_twophase_recover(), LockReleaseAll(), LogicalRepApplyLoop(), ParallelContextActive(), pgstat_flush_pending_entries(), pgstat_report_stat(), pgstat_shutdown_hook(), PostPrepare_Locks(), ProcKill(), ReleasePredicateLocks(), RemoveTargetIfNoLongerUsed(), ReorderBufferBuildTupleCidHash(), ReorderBufferGetOldestTXN(), ReorderBufferGetOldestXmin(), ReorderBufferIterTXNFinish(), ReorderBufferIterTXNNext(), ReorderBufferRestoreChanges(), ReorderBufferSerializeTXN(), ReorderBufferStreamTXN(), RWConflictExists(), SetPossibleUnsafeConflict(), SetRWConflict(), SetupLockInTable(), SlabAlloc(), SlabAllocFromNewBlock(), SlabFindNextBlockListIndex(), SlabFree(), SummarizeOldestCommittedSxact(), TransferPredicateLocksToNewTarget(), XLogPrefetcherCompleteFilters(), and XLogPrefetcherIsFiltered().

◆ dlist_move_head()

static void dlist_move_head ( dlist_head head,
dlist_node node 
)
inlinestatic

Definition at line 467 of file ilist.h.

468 {
469  /* fast path if it's already at the head */
470  if (head->head.next == node)
471  return;
472 
473  dlist_delete(node);
474  dlist_push_head(head, node);
475 
476  dlist_check(head);
477 }

References dlist_check, dlist_delete(), dlist_push_head(), dlist_head::head, and dlist_node::next.

Referenced by dclist_move_head(), launch_worker(), SearchCatCacheInternal(), and SearchCatCacheList().

◆ dlist_move_tail()

static void dlist_move_tail ( dlist_head head,
dlist_node node 
)
inlinestatic

Definition at line 486 of file ilist.h.

487 {
488  /* fast path if it's already at the tail */
489  if (head->head.prev == node)
490  return;
491 
492  dlist_delete(node);
493  dlist_push_tail(head, node);
494 
495  dlist_check(head);
496 }

References dlist_check, dlist_delete(), dlist_push_tail(), dlist_head::head, and dlist_node::prev.

Referenced by cache_lookup(), and dclist_move_tail().

◆ dlist_next_node()

static dlist_node* dlist_next_node ( dlist_head head,
dlist_node node 
)
inlinestatic

Definition at line 537 of file ilist.h.

538 {
539  Assert(dlist_has_next(head, node));
540  return node->next;
541 }

References Assert, dlist_has_next(), and dlist_node::next.

Referenced by addItemsToLeaf(), dataPlaceToPageLeafSplit(), dclist_next_node(), leafRepackItems(), pgstat_flush_pending_entries(), and ReorderBufferIterTXNNext().

◆ dlist_node_init()

static void dlist_node_init ( dlist_node node)
inlinestatic

◆ dlist_node_is_detached()

static bool dlist_node_is_detached ( const dlist_node node)
inlinestatic

Definition at line 525 of file ilist.h.

526 {
527  Assert((node->next == NULL && node->prev == NULL) ||
528  (node->next != NULL && node->prev != NULL));
529 
530  return node->next == NULL;
531 }

References Assert, dlist_node::next, and dlist_node::prev.

Referenced by LockErrorCleanup(), ProcWakeup(), SyncRepCancelWait(), SyncRepCleanupAtProcExit(), and SyncRepWaitForLSN().

◆ dlist_pop_head_node()

static dlist_node* dlist_pop_head_node ( dlist_head head)
inlinestatic

Definition at line 450 of file ilist.h.

451 {
452  dlist_node *node;
453 
454  Assert(!dlist_is_empty(head));
455  node = head->head.next;
456  dlist_delete(node);
457  return node;
458 }

References Assert, dlist_delete(), dlist_is_empty(), dlist_head::head, and dlist_node::next.

Referenced by AssignPostmasterChildSlot(), CreatePredXact(), dclist_pop_head_node(), do_start_worker(), InitProcess(), ReorderBufferIterTXNFinish(), and ReorderBufferIterTXNNext().

◆ dlist_prev_node()

static dlist_node* dlist_prev_node ( dlist_head head,
dlist_node node 
)
inlinestatic

Definition at line 547 of file ilist.h.

548 {
549  Assert(dlist_has_prev(head, node));
550  return node->prev;
551 }

References Assert, dlist_has_prev(), and dlist_node::prev.

Referenced by dataBeginPlaceToPageLeaf(), dclist_prev_node(), and leafRepackItems().

◆ dlist_push_head()

◆ dlist_push_tail()

◆ dlist_tail_element_off()

static void* dlist_tail_element_off ( dlist_head head,
size_t  off 
)
inlinestatic

Definition at line 572 of file ilist.h.

573 {
574  Assert(!dlist_is_empty(head));
575  return (char *) head->head.prev - off;
576 }

References Assert, dlist_is_empty(), dlist_head::head, and dlist_node::prev.

Referenced by dclist_tail_node(), and dlist_tail_node().

◆ dlist_tail_node()

static dlist_node* dlist_tail_node ( dlist_head head)
inlinestatic

Definition at line 582 of file ilist.h.

583 {
584  return (dlist_node *) dlist_tail_element_off(head, 0);
585 }

References dlist_tail_element_off().

Referenced by dataBeginPlaceToPageLeaf().

◆ slist_delete()

void slist_delete ( slist_head head,
const slist_node node 
)

Definition at line 31 of file ilist.c.

32 {
33  slist_node *last = &head->head;
34  slist_node *cur;
35  bool found PG_USED_FOR_ASSERTS_ONLY = false;
36 
37  while ((cur = last->next) != NULL)
38  {
39  if (cur == node)
40  {
41  last->next = cur->next;
42 #ifdef USE_ASSERT_CHECKING
43  found = true;
44 #endif
45  break;
46  }
47  last = cur;
48  }
49  Assert(found);
50 
51  slist_check(head);
52 }
#define PG_USED_FOR_ASSERTS_ONLY
Definition: c.h:201
#define slist_check(head)
Definition: ilist.h:304
slist_node head
Definition: ilist.h:238
slist_node * next
Definition: ilist.h:226

References Assert, cur, slist_head::head, slist_node::next, cursor::next, PG_USED_FOR_ASSERTS_ONLY, and slist_check.

Referenced by reapply_stacked_values(), and RemoveGUCFromLists().

◆ slist_delete_current()

static void slist_delete_current ( slist_mutable_iter iter)
inlinestatic

Definition at line 1084 of file ilist.h.

1085 {
1086  /*
1087  * Update previous element's forward link. If the iteration is at the
1088  * first list element, iter->prev will point to the list header's "head"
1089  * field, so we don't need a special case for that.
1090  */
1091  iter->prev->next = iter->next;
1092 
1093  /*
1094  * Reset cur to prev, so that prev will continue to point to the prior
1095  * valid list element after slist_foreach_modify() advances to the next.
1096  */
1097  iter->cur = iter->prev;
1098 }
slist_node * next
Definition: ilist.h:275
slist_node * prev
Definition: ilist.h:276
slist_node * cur
Definition: ilist.h:274

References slist_mutable_iter::cur, slist_node::next, slist_mutable_iter::next, and slist_mutable_iter::prev.

Referenced by AtEOSubXact_SPI(), AtEOXact_GUC(), cancel_on_dsm_detach(), ReportChangedGUCOptions(), and SPI_freetuptable().

◆ slist_has_next()

static bool slist_has_next ( const slist_head head,
const slist_node node 
)
inlinestatic

Definition at line 1043 of file ilist.h.

1044 {
1045  slist_check(head);
1046 
1047  return node->next != NULL;
1048 }

References slist_node::next, and slist_check.

Referenced by slist_next_node().

◆ slist_head_element_off()

static void* slist_head_element_off ( slist_head head,
size_t  off 
)
inlinestatic

Definition at line 1062 of file ilist.h.

1063 {
1064  Assert(!slist_is_empty(head));
1065  return (char *) head->head.next - off;
1066 }
static bool slist_is_empty(const slist_head *head)
Definition: ilist.h:995

References Assert, slist_head::head, slist_node::next, and slist_is_empty().

Referenced by slist_head_node().

◆ slist_head_node()

static slist_node* slist_head_node ( slist_head head)
inlinestatic

Definition at line 1072 of file ilist.h.

1073 {
1074  return (slist_node *) slist_head_element_off(head, 0);
1075 }

References slist_head_element_off().

◆ slist_init()

static void slist_init ( slist_head head)
inlinestatic

Definition at line 986 of file ilist.h.

987 {
988  head->head.next = NULL;
989 }

References slist_head::head, and slist_node::next.

Referenced by dsm_create_descriptor(), EventTriggerBeginCompleteQuery(), InitCatCache(), and SPI_connect_ext().

◆ slist_insert_after()

static void slist_insert_after ( slist_node after,
slist_node node 
)
inlinestatic

Definition at line 1018 of file ilist.h.

1019 {
1020  node->next = after->next;
1021  after->next = node;
1022 }

References slist_node::next.

◆ slist_is_empty()

static bool slist_is_empty ( const slist_head head)
inlinestatic

Definition at line 995 of file ilist.h.

996 {
997  slist_check(head);
998 
999  return head->head.next == NULL;
1000 }

References slist_head::head, slist_node::next, and slist_check.

Referenced by dsm_detach(), EventTriggerSQLDrop(), reset_on_dsm_detach(), slist_head_element_off(), and slist_pop_head_node().

◆ slist_next_node()

static slist_node* slist_next_node ( slist_head head,
slist_node node 
)
inlinestatic

Definition at line 1054 of file ilist.h.

1055 {
1056  Assert(slist_has_next(head, node));
1057  return node->next;
1058 }
static bool slist_has_next(const slist_head *head, const slist_node *node)
Definition: ilist.h:1043

References Assert, slist_node::next, and slist_has_next().

◆ slist_pop_head_node()

static slist_node* slist_pop_head_node ( slist_head head)
inlinestatic

Definition at line 1028 of file ilist.h.

1029 {
1030  slist_node *node;
1031 
1032  Assert(!slist_is_empty(head));
1033  node = head->head.next;
1034  head->head.next = node->next;
1035  slist_check(head);
1036  return node;
1037 }

References Assert, slist_head::head, slist_node::next, slist_check, and slist_is_empty().

Referenced by dsm_detach(), and reset_on_dsm_detach().

◆ slist_push_head()

static void slist_push_head ( slist_head head,
slist_node node 
)
inlinestatic

Definition at line 1006 of file ilist.h.

1007 {
1008  node->next = head->head.next;
1009  head->head.next = node;
1010 
1011  slist_check(head);
1012 }

References slist_head::head, slist_node::next, and slist_check.

Referenced by AtEOXact_GUC(), EventTriggerSQLDropAddObject(), InitCatCache(), on_dsm_detach(), push_old_value(), ResetAllOptions(), set_config_with_handle(), and spi_dest_startup().