Ruby: prism/util/pm_list.h Source File

Ruby 3.3.4p94 (2024-07-09 revision be1089c8ec5ba40e09b1553e36b3174bf4014d9d)

pm_list.h
Go to the documentation of this file.
1
6#ifndef PRISM_LIST_H
7#define PRISM_LIST_H
8
9#include "prism/defines.h"
10
11#include <stdbool.h>
12#include <stddef.h>
13#include <stdint.h>
14#include <stdlib.h>
15
46 typedef struct pm_list_node {
48 struct pm_list_node *next;
49} pm_list_node_t;
50
55 typedef struct {
57 size_t size;
58
60 pm_list_node_t *head;
61
63 pm_list_node_t *tail;
64} pm_list_t;
65
72 PRISM_EXPORTED_FUNCTION bool pm_list_empty_p(pm_list_t *list);
73
80 PRISM_EXPORTED_FUNCTION size_t pm_list_size(pm_list_t *list);
81
88void pm_list_append(pm_list_t *list, pm_list_node_t *node);
89
95 PRISM_EXPORTED_FUNCTION void pm_list_free(pm_list_t *list);
96
97#endif
pm_list_empty_p
PRISM_EXPORTED_FUNCTION bool pm_list_empty_p(pm_list_t *list)
Returns true if the given list is empty.
Definition pm_list.c:7
pm_list_node_t
struct pm_list_node pm_list_node_t
This struct represents an abstract linked list that provides common functionality.
pm_list_size
PRISM_EXPORTED_FUNCTION size_t pm_list_size(pm_list_t *list)
Returns the size of the list.
Definition pm_list.c:15
pm_list_append
void pm_list_append(pm_list_t *list, pm_list_node_t *node)
Append a node to the given list.
Definition pm_list.c:23
pm_list_free
PRISM_EXPORTED_FUNCTION void pm_list_free(pm_list_t *list)
Deallocate the internal state of the given list.
Definition pm_list.c:38
defines.h
Macro definitions used throughout the prism library.
PRISM_EXPORTED_FUNCTION
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
Definition defines.h:32
stdbool.h
C99 shim for <stdbool.h>
pm_list_node
This struct represents an abstract linked list that provides common functionality.
Definition pm_list.h:46
pm_list_node::next
struct pm_list_node * next
A pointer to the next node in the list.
Definition pm_list.h:48
pm_list_t
This represents the overall linked list.
Definition pm_list.h:55
pm_list_t::tail
pm_list_node_t * tail
A pointer to the tail of the list.
Definition pm_list.h:63
pm_list_t::head
pm_list_node_t * head
A pointer to the head of the list.
Definition pm_list.h:60
pm_list_t::size
size_t size
The size of the list.
Definition pm_list.h:57