Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
agxbuf Struct Reference

#include <agxbuf.h>

Data Fields

union { 
 
   struct { 
 
      char *   buf 
 start of buffer More...
 
      size_t   size 
 number of characters in the buffer More...
 
      size_t   capacity 
 available bytes in the buffer More...
 
      char   padding [sizeof(size_t) - 1] 
 unused; for alignment More...
 
      unsigned char   located 
 where does the backing memory for this buffer live? More...
 
   }   s 
 
   char   store [sizeof(char *)+sizeof(size_t) *3 - 1] 
 
u 
 

Detailed Description

extensible buffer

Malloc'ed memory is never released until agxbdisown or agxbfree is called.

This has the following layout assuming x86-64.

                                                          located
                                                             ↓

┌───────────────┬───────────────┬───────────────┬─────────────┬─┐ │ buf │ size │ capacity │ padding │ │ ├───────────────┴───────────────┴───────────────┴─────────────┼─┤ │ store │ │ └─────────────────────────────────────────────────────────────┴─┘ 0 8 16 24 32

buf, size, and capacity are in use when located is AGXBUF_ON_HEAP. store is in use when located is < AGXBUF_ON_HEAP.

Definition at line 54 of file agxbuf.h.

Field Documentation

◆ buf

char* agxbuf::buf

Definition at line 57 of file agxbuf.h.

Referenced by agxbdisown(), agxbfree(), agxbmore(), agxbnext(), agxbpop(), agxbput_n(), agxbputc(), and agxbstart().

◆ capacity

size_t agxbuf::capacity

Definition at line 59 of file agxbuf.h.

Referenced by agxbmore(), and agxbsizeof().

◆ located

unsigned char agxbuf::located

◆ padding

char agxbuf::padding[sizeof(size_t) - 1]

Definition at line 60 of file agxbuf.h.

◆ [struct]

◆ size

size_t agxbuf::size

◆ store

char agxbuf::store[sizeof(char *)+sizeof(size_t) *3 - 1]

inline storage used when located is < AGXBUF_ON_HEAP

Definition at line 64 of file agxbuf.h.

Referenced by agxbdisown(), agxbmore(), agxbnext(), agxbpop(), agxbput_n(), agxbputc(), agxbsizeof(), agxbstart(), agxbuf_is_inline(), agxbuse(), and vagxbprint().

◆ [union]


The documentation for this struct was generated from the following file: