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, slist_node *node)
 
static void dlist_init (dlist_head *head)
 
static bool dlist_is_empty (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_from (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 (dlist_head *head, dlist_node *node)
 
static bool dlist_has_prev (dlist_head *head, 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 (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 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 (dclist_head *head, dlist_node *node)
 
static bool dclist_has_prev (dclist_head *head, 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 (dclist_head *head)
 
static void slist_init (slist_head *head)
 
static bool slist_is_empty (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 (slist_head *head, 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 884 of file ilist.h.

◆ dclist_foreach

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

Definition at line 907 of file ilist.h.

◆ dclist_foreach_modify

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

Definition at line 910 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:917
static void * dclist_head_element_off(dclist_head *head, size_t off)
Definition: ilist.h:825

Definition at line 892 of file ilist.h.

◆ dclist_reverse_foreach

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

Definition at line 913 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:846

Definition at line 901 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 543 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:28
struct cursor * next
Definition: type.h:147

Definition at line 573 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 590 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:505

Definition at line 553 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 604 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:522

Definition at line 562 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 1043 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 1069 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 1085 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:999

Definition at line 1053 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 ( dclist_head head)
inlinestatic

Definition at line 869 of file ilist.h.

870 {
871  Assert(dlist_is_empty(&head->dlist) == (head->count == 0));
872 
873  return head->count;
874 }
static bool dlist_is_empty(dlist_head *head)
Definition: ilist.h:325
Assert(fmt[strlen(fmt) - 1] !='\n')
uint32 count
Definition: ilist.h:215
dlist_head dlist
Definition: ilist.h:214

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

Referenced by AtEOSubXact_PgStat_DroppedStats(), AtEOXact_PgStat_DroppedStats(), InvalidateConstraintCacheCallBack(), logical_heap_rewrite_flush_mappings(), mXactCachePut(), pgstat_get_transactional_drops(), ReorderBufferGetCatalogChangesXacts(), and SnapBuildSerialize().

◆ dclist_delete_from()

static void dclist_delete_from ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 713 of file ilist.h.

714 {
715  Assert(head->count > 0);
716 
717  dlist_delete_from(&head->dlist, node);
718  head->count--;
719 }
static void dlist_delete_from(dlist_head *head, dlist_node *node)
Definition: ilist.h:405

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(), and ReorderBufferCleanupTXN().

◆ dclist_has_next()

static bool dclist_has_next ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 776 of file ilist.h.

777 {
778  dlist_member_check(&head->dlist, node);
779  Assert(head->count > 0);
780 
781  return dlist_has_next(&head->dlist, node);
782 }
static bool dlist_has_next(dlist_head *head, dlist_node *node)
Definition: ilist.h:468
#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 ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 791 of file ilist.h.

792 {
793  dlist_member_check(&head->dlist, node);
794  Assert(head->count > 0);
795 
796  return dlist_has_prev(&head->dlist, node);
797 }
static bool dlist_has_prev(dlist_head *head, dlist_node *node)
Definition: ilist.h:478

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 825 of file ilist.h.

826 {
827  Assert(!dclist_is_empty(head));
828 
829  return (char *) head->dlist.head.next - off;
830 }
static bool dclist_is_empty(dclist_head *head)
Definition: ilist.h:632
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 837 of file ilist.h.

838 {
839  Assert(head->count > 0);
840 
841  return (dlist_node *) dlist_head_element_off(&head->dlist, 0);
842 }

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

◆ dclist_init()

static void dclist_init ( dclist_head head)
inlinestatic

Definition at line 621 of file ilist.h.

622 {
623  dlist_init(&head->dlist);
624  head->count = 0;
625 }
static void dlist_init(dlist_head *head)
Definition: ilist.h:314

References dclist_head::count, dclist_head::dlist, and dlist_init().

Referenced by AtEOXact_MultiXact(), dclist_push_head(), dclist_push_tail(), logical_rewrite_log_mapping(), pgstat_get_xact_stack_level(), PostPrepare_MultiXact(), and ReorderBufferAllocate().

◆ dclist_insert_after()

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

Definition at line 677 of file ilist.h.

678 {
679  dlist_member_check(&head->dlist, after);
680  Assert(head->count > 0); /* must be at least 1 already */
681 
682  dlist_insert_after(after, node);
683  head->count++;
684 
685  Assert(head->count > 0); /* count overflow check */
686 }
static void dlist_insert_after(dlist_node *after, dlist_node *node)
Definition: ilist.h:370

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 695 of file ilist.h.

696 {
698  Assert(head->count > 0); /* must be at least 1 already */
699 
701  head->count++;
702 
703  Assert(head->count > 0); /* count overflow check */
704 }
static void dlist_insert_before(dlist_node *before, dlist_node *node)
Definition: ilist.h:382
static int before(chr x, chr y)
Definition: regc_locale.c:492

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

◆ dclist_is_empty()

static bool dclist_is_empty ( dclist_head head)
inlinestatic

Definition at line 632 of file ilist.h.

633 {
634  Assert(dlist_is_empty(&head->dlist) == (head->count == 0));
635  return (head->count == 0);
636 }

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

Referenced by dclist_head_element_off(), and dclist_tail_element_off().

◆ dclist_move_head()

static void dclist_move_head ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 745 of file ilist.h.

746 {
747  dlist_member_check(&head->dlist, node);
748  Assert(head->count > 0);
749 
750  dlist_move_head(&head->dlist, node);
751 }
static void dlist_move_head(dlist_head *head, dlist_node *node)
Definition: ilist.h:432

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 761 of file ilist.h.

762 {
763  dlist_member_check(&head->dlist, node);
764  Assert(head->count > 0);
765 
766  dlist_move_tail(&head->dlist, node);
767 }
static void dlist_move_tail(dlist_head *head, dlist_node *node)
Definition: ilist.h:451

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 804 of file ilist.h.

805 {
806  Assert(head->count > 0);
807 
808  return dlist_next_node(&head->dlist, node);
809 }
static dlist_node * dlist_next_node(dlist_head *head, dlist_node *node)
Definition: ilist.h:487

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 726 of file ilist.h.

727 {
728  dlist_node *node;
729 
730  Assert(head->count > 0);
731 
732  node = dlist_pop_head_node(&head->dlist);
733  head->count--;
734  return node;
735 }
static dlist_node * dlist_pop_head_node(dlist_head *head)
Definition: ilist.h:415

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

◆ dclist_prev_node()

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

Definition at line 816 of file ilist.h.

817 {
818  Assert(head->count > 0);
819 
820  return dlist_prev_node(&head->dlist, node);
821 }
static dlist_node * dlist_prev_node(dlist_head *head, dlist_node *node)
Definition: ilist.h:497

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 643 of file ilist.h.

644 {
645  if (head->dlist.head.next == NULL) /* convert NULL header to circular */
646  dclist_init(head);
647 
648  dlist_push_head(&head->dlist, node);
649  head->count++;
650 
651  Assert(head->count > 0); /* count overflow check */
652 }
static void dlist_push_head(dlist_head *head, dlist_node *node)
Definition: ilist.h:336
static void dclist_init(dclist_head *head)
Definition: ilist.h:621

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

Referenced by mXactCachePut().

◆ dclist_push_tail()

static void dclist_push_tail ( dclist_head head,
dlist_node node 
)
inlinestatic

Definition at line 659 of file ilist.h.

660 {
661  if (head->dlist.head.next == NULL) /* convert NULL header to circular */
662  dclist_init(head);
663 
664  dlist_push_tail(&head->dlist, node);
665  head->count++;
666 
667  Assert(head->count > 0); /* count overflow check */
668 }
static void dlist_push_tail(dlist_head *head, dlist_node *node)
Definition: ilist.h:353

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(), 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 846 of file ilist.h.

847 {
848  Assert(!dclist_is_empty(head));
849 
850  return (char *) head->dlist.head.prev - off;
851 }
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 857 of file ilist.h.

858 {
859  Assert(head->count > 0);
860 
861  return (dlist_node *) dlist_tail_element_off(&head->dlist, 0);
862 }

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

Referenced by mXactCachePut().

◆ dlist_delete()

◆ dlist_delete_from()

static void dlist_delete_from ( dlist_head head,
dlist_node node 
)
inlinestatic

Definition at line 405 of file ilist.h.

406 {
407  dlist_member_check(head, node);
408  dlist_delete(node);
409 }
static void dlist_delete(dlist_node *node)
Definition: ilist.h:394

References dlist_delete(), and dlist_member_check.

Referenced by dclist_delete_from().

◆ dlist_has_next()

static bool dlist_has_next ( dlist_head head,
dlist_node node 
)
inlinestatic

◆ dlist_has_prev()

static bool dlist_has_prev ( dlist_head head,
dlist_node node 
)
inlinestatic

Definition at line 478 of file ilist.h.

479 {
480  return node->prev != &head->head;
481 }

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 505 of file ilist.h.

506 {
507  Assert(!dlist_is_empty(head));
508  return (char *) head->head.next - off;
509 }

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

Definition at line 515 of file ilist.h.

516 {
517  return (dlist_node *) dlist_head_element_off(head, 0);
518 }

References dlist_head_element_off().

Referenced by dataPlaceToPageLeafSplit(), GenerationReset(), leafRepackItems(), and pgstat_flush_pending_entries().

◆ dlist_init()

◆ dlist_insert_after()

static void dlist_insert_after ( dlist_node after,
dlist_node node 
)
inlinestatic

Definition at line 370 of file ilist.h.

371 {
372  node->prev = after;
373  node->next = after->next;
374  after->next = node;
375  node->next->prev = node;
376 }

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

Referenced by dclist_insert_after(), and leafRepackItems().

◆ dlist_insert_before()

static void dlist_insert_before ( dlist_node before,
dlist_node node 
)
inlinestatic

Definition at line 382 of file ilist.h.

383 {
384  node->prev = before->prev;
385  node->next = before;
386  before->prev = node;
387  node->prev->next = node;
388 }

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

Referenced by dclist_insert_before(), and ReorderBufferTransferSnapToParent().

◆ dlist_is_empty()

◆ dlist_move_head()

static void dlist_move_head ( dlist_head head,
dlist_node node 
)
inlinestatic

Definition at line 432 of file ilist.h.

433 {
434  /* fast path if it's already at the head */
435  if (head->head.next == node)
436  return;
437 
438  dlist_delete(node);
439  dlist_push_head(head, node);
440 
441  dlist_check(head);
442 }

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 451 of file ilist.h.

452 {
453  /* fast path if it's already at the tail */
454  if (head->head.prev == node)
455  return;
456 
457  dlist_delete(node);
458  dlist_push_tail(head, node);
459 
460  dlist_check(head);
461 }

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 487 of file ilist.h.

488 {
489  Assert(dlist_has_next(head, node));
490  return node->next;
491 }

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

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

◆ dlist_pop_head_node()

static dlist_node* dlist_pop_head_node ( dlist_head head)
inlinestatic

Definition at line 415 of file ilist.h.

416 {
417  dlist_node *node;
418 
419  Assert(!dlist_is_empty(head));
420  node = head->head.next;
421  dlist_delete(node);
422  return node;
423 }

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

Referenced by dclist_pop_head_node(), do_start_worker(), ReorderBufferIterTXNFinish(), and ReorderBufferIterTXNNext().

◆ dlist_prev_node()

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

Definition at line 497 of file ilist.h.

498 {
499  Assert(dlist_has_prev(head, node));
500  return node->prev;
501 }

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

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

◆ dlist_push_head()

static void dlist_push_head ( dlist_head head,
dlist_node node 
)
inlinestatic

◆ dlist_push_tail()

◆ dlist_tail_element_off()

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

Definition at line 522 of file ilist.h.

523 {
524  Assert(!dlist_is_empty(head));
525  return (char *) head->head.prev - off;
526 }

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 532 of file ilist.h.

533 {
534  return (dlist_node *) dlist_tail_element_off(head, 0);
535 }

References dlist_tail_element_off().

Referenced by dataBeginPlaceToPageLeaf().

◆ slist_delete()

void slist_delete ( slist_head head,
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:166
#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 1021 of file ilist.h.

1022 {
1023  /*
1024  * Update previous element's forward link. If the iteration is at the
1025  * first list element, iter->prev will point to the list header's "head"
1026  * field, so we don't need a special case for that.
1027  */
1028  iter->prev->next = iter->next;
1029 
1030  /*
1031  * Reset cur to prev, so that prev will continue to point to the prior
1032  * valid list element after slist_foreach_modify() advances to the next.
1033  */
1034  iter->cur = iter->prev;
1035 }
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(), ForgetBackgroundWorker(), ReportChangedGUCOptions(), and SPI_freetuptable().

◆ slist_has_next()

static bool slist_has_next ( slist_head head,
slist_node node 
)
inlinestatic

Definition at line 980 of file ilist.h.

981 {
982  slist_check(head);
983 
984  return node->next != NULL;
985 }

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 999 of file ilist.h.

1000 {
1001  Assert(!slist_is_empty(head));
1002  return (char *) head->head.next - off;
1003 }
static bool slist_is_empty(slist_head *head)
Definition: ilist.h:932

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 1009 of file ilist.h.

1010 {
1011  return (slist_node *) slist_head_element_off(head, 0);
1012 }

References slist_head_element_off().

◆ slist_init()

static void slist_init ( slist_head head)
inlinestatic

Definition at line 923 of file ilist.h.

924 {
925  head->head.next = NULL;
926 }

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 955 of file ilist.h.

956 {
957  node->next = after->next;
958  after->next = node;
959 }

References slist_node::next.

◆ slist_is_empty()

static bool slist_is_empty ( slist_head head)
inlinestatic

Definition at line 932 of file ilist.h.

933 {
934  slist_check(head);
935 
936  return head->head.next == NULL;
937 }

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 991 of file ilist.h.

992 {
993  Assert(slist_has_next(head, node));
994  return node->next;
995 }
static bool slist_has_next(slist_head *head, slist_node *node)
Definition: ilist.h:980

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 965 of file ilist.h.

966 {
967  slist_node *node;
968 
969  Assert(!slist_is_empty(head));
970  node = head->head.next;
971  head->head.next = node->next;
972  slist_check(head);
973  return node;
974 }

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