Graphviz 12.0.1~dev.20240715.2254
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 53 of file agxbuf.h.

Field Documentation

◆ buf

char* agxbuf::buf

◆ capacity

size_t agxbuf::capacity

Definition at line 58 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 59 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 63 of file agxbuf.h.

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

◆ [union]


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