Header And Logo

PostgreSQL
| The world's most advanced open source database.

Data Structures | Defines | Typedefs | Functions

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  slist_node
struct  slist_head
struct  slist_iter
struct  slist_mutable_iter

Defines

#define DLIST_STATIC_INIT(name)   {{&(name).head, &(name).head}}
#define SLIST_STATIC_INIT(name)   {{NULL}}
#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 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 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)
void dlist_init (dlist_head *head)
bool dlist_is_empty (dlist_head *head)
void dlist_push_head (dlist_head *head, dlist_node *node)
void dlist_push_tail (dlist_head *head, dlist_node *node)
void dlist_insert_after (dlist_node *after, dlist_node *node)
void dlist_insert_before (dlist_node *before, dlist_node *node)
void dlist_delete (dlist_node *node)
dlist_nodedlist_pop_head_node (dlist_head *head)
void dlist_move_head (dlist_head *head, dlist_node *node)
bool dlist_has_next (dlist_head *head, dlist_node *node)
bool dlist_has_prev (dlist_head *head, dlist_node *node)
dlist_nodedlist_next_node (dlist_head *head, dlist_node *node)
dlist_nodedlist_prev_node (dlist_head *head, dlist_node *node)
dlist_nodedlist_head_node (dlist_head *head)
dlist_nodedlist_tail_node (dlist_head *head)
void * dlist_tail_element_off (dlist_head *head, size_t off)
void * dlist_head_element_off (dlist_head *head, size_t off)
void slist_init (slist_head *head)
bool slist_is_empty (slist_head *head)
void slist_push_head (slist_head *head, slist_node *node)
void slist_insert_after (slist_node *after, slist_node *node)
slist_nodeslist_pop_head_node (slist_head *head)
bool slist_has_next (slist_head *head, slist_node *node)
slist_nodeslist_next_node (slist_head *head, slist_node *node)
slist_nodeslist_head_node (slist_head *head)
void * slist_head_element_off (slist_head *head, size_t off)

Define Documentation

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

Definition at line 259 of file ilist.h.

#define dlist_container (   type,
  membername,
  ptr 
)
#define dlist_foreach (   iter,
  lhead 
)
Value:
for (AssertVariableIsOfTypeMacro(iter, dlist_iter),                     \
         AssertVariableIsOfTypeMacro(lhead, dlist_head *),                  \
         (iter).end = &(lhead)->head,                                       \
         (iter).cur = (iter).end->next ? (iter).end->next : (iter).end;     \
         (iter).cur != (iter).end;                                          \
         (iter).cur = (iter).cur->next)

Definition at line 527 of file ilist.h.

Referenced by AtEOXact_CatCache(), autovac_balance_cost(), CountChildren(), do_autovacuum(), launch_worker(), processCancelRequest(), rebuild_database_list(), SearchCatCache(), SearchCatCacheList(), and SignalSomeChildren().

#define dlist_foreach_modify (   iter,
  lhead 
)
Value:
for (AssertVariableIsOfTypeMacro(iter, dlist_mutable_iter),             \
         AssertVariableIsOfTypeMacro(lhead, dlist_head *),                  \
         (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 544 of file ilist.h.

Referenced by CatalogCacheIdInvalidate(), CleanupBackend(), HandleChildCrash(), and ResetCatalogCache().

#define dlist_head_element (   type,
  membername,
  lhead 
)
Value:
(AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node),  \
     (type *) dlist_head_element_off(lhead, offsetof(type, membername)))

Definition at line 507 of file ilist.h.

#define dlist_reverse_foreach (   iter,
  lhead 
)
Value:
for (AssertVariableIsOfTypeMacro(iter, dlist_iter),                     \
         AssertVariableIsOfTypeMacro(lhead, dlist_head *),                  \
         (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 558 of file ilist.h.

Referenced by do_start_worker().

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

Definition at line 240 of file ilist.h.

#define dlist_tail_element (   type,
  membername,
  lhead 
)
Value:
(AssertVariableIsOfTypeMacro(((type *) NULL)->membername, dlist_node),  \
     ((type *) dlist_tail_element_off(lhead, offsetof(type, membername))))

Definition at line 516 of file ilist.h.

Referenced by AutoVacLauncherMain(), and launcher_determine_sleep().

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

Definition at line 260 of file ilist.h.

Referenced by slist_delete().

#define slist_container (   type,
  membername,
  ptr 
)
#define slist_foreach (   iter,
  lhead 
)
#define slist_foreach_modify (   iter,
  lhead 
)
Value:
for (AssertVariableIsOfTypeMacro(iter, slist_mutable_iter),             \
         AssertVariableIsOfTypeMacro(lhead, slist_head *),                  \
         (iter).cur = (lhead)->head.next,                                   \
         (iter).next = (iter).cur ? (iter).cur->next : NULL;                \
         (iter).cur != NULL;                                                \
         (iter).cur = (iter).next,                                          \
         (iter).next = (iter).next ? (iter).next->next : NULL)

Definition at line 726 of file ilist.h.

Referenced by pgstat_write_statsfiles().

#define slist_head_element (   type,
  membername,
  lhead 
)
Value:
(AssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node),  \
     (type *) slist_head_element_off(lhead, offsetof(type, membername)))

Definition at line 700 of file ilist.h.

#define SLIST_STATIC_INIT (   name  )     {{NULL}}

Definition at line 241 of file ilist.h.


Typedef Documentation

typedef struct dlist_head dlist_head
typedef struct dlist_iter dlist_iter
typedef struct dlist_node dlist_node

Definition at line 120 of file ilist.h.

typedef struct slist_head slist_head
typedef struct slist_iter slist_iter
typedef struct slist_node slist_node

Definition at line 190 of file ilist.h.


Function Documentation

void dlist_delete ( dlist_node node  ) 
bool dlist_has_next ( dlist_head head,
dlist_node node 
)
bool dlist_has_prev ( dlist_head head,
dlist_node node 
)
void* dlist_head_element_off ( dlist_head head,
size_t  off 
)
dlist_node* dlist_head_node ( dlist_head head  ) 
void dlist_init ( dlist_head head  ) 
void dlist_insert_after ( dlist_node after,
dlist_node node 
)
void dlist_insert_before ( dlist_node before,
dlist_node node 
)
bool dlist_is_empty ( dlist_head head  ) 
void dlist_move_head ( dlist_head head,
dlist_node node 
)
dlist_node* dlist_next_node ( dlist_head head,
dlist_node node 
)
dlist_node* dlist_pop_head_node ( dlist_head head  ) 

Referenced by do_start_worker().

dlist_node* dlist_prev_node ( dlist_head head,
dlist_node node 
)
void dlist_push_head ( dlist_head head,
dlist_node node 
)
void dlist_push_tail ( dlist_head head,
dlist_node node 
)
void* dlist_tail_element_off ( dlist_head head,
size_t  off 
)
dlist_node* dlist_tail_node ( dlist_head head  ) 
void slist_delete ( slist_head head,
slist_node node 
)

Definition at line 34 of file ilist.c.

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

{
    slist_node *last = &head->head;
    slist_node *cur;
    bool found  PG_USED_FOR_ASSERTS_ONLY = false;

    while ((cur = last->next) != NULL)
    {
        if (cur == node)
        {
            last->next = cur->next;
#ifdef USE_ASSERT_CHECKING
            found = true;
#endif
            break;
        }
        last = cur;
    }
    Assert(found);

    slist_check(head);
}

bool slist_has_next ( slist_head head,
slist_node node 
)
void* slist_head_element_off ( slist_head head,
size_t  off 
)
slist_node* slist_head_node ( slist_head head  ) 
void slist_init ( slist_head head  ) 
void slist_insert_after ( slist_node after,
slist_node node 
)
bool slist_is_empty ( slist_head head  ) 
slist_node* slist_next_node ( slist_head head,
slist_node node 
)
slist_node* slist_pop_head_node ( slist_head head  ) 
void slist_push_head ( slist_head head,
slist_node node 
)