dpkg 1.21.11
Data Structures | Macros | Functions
Variable length buffers
Collaboration diagram for Variable length buffers:

Data Structures

struct  varbuf
 varbuf_init must be called exactly once before the use of each varbuf (including before any call to varbuf_destroy), or the variable must be initialized with VARBUF_INIT. More...
 
struct  varbuf_state
 

Macros

#define VARBUF_INIT   { 0, 0, NULL }
 
#define VARBUF_OBJECT   (struct varbuf)VARBUF_INIT
 
#define varbuf_add_str(v, s)   varbuf_add_buf(v, s, strlen(s))
 

Functions

struct varbufvarbuf_new (size_t size)
 
void varbuf_init (struct varbuf *v, size_t size)
 
void varbuf_grow (struct varbuf *v, size_t need_size)
 
void varbuf_trunc (struct varbuf *v, size_t used_size)
 
char * varbuf_detach (struct varbuf *v)
 
void varbuf_reset (struct varbuf *v)
 
void varbuf_destroy (struct varbuf *v)
 
void varbuf_free (struct varbuf *v)
 
void varbuf_add_char (struct varbuf *v, int c)
 
void varbuf_dup_char (struct varbuf *v, int c, size_t n)
 
void varbuf_map_char (struct varbuf *v, int c_src, int c_dst)
 
void varbuf_add_dir (struct varbuf *v, const char *dirname)
 
void varbuf_add_buf (struct varbuf *v, const void *s, size_t size)
 
void varbuf_end_str (struct varbuf *v)
 
const char * varbuf_get_str (struct varbuf *v)
 
int varbuf_printf (struct varbuf *v, const char *fmt,...) DPKG_ATTR_PRINTF(2)
 
int varbuf_vprintf (struct varbuf *v, const char *fmt, va_list va) DPKG_ATTR_VPRINTF(2)
 
void varbuf_snapshot (struct varbuf *v, struct varbuf_state *vs)
 
void varbuf_rollback (struct varbuf_state *vs)
 
size_t varbuf_rollback_len (struct varbuf_state *vs)
 
const char * varbuf_rollback_start (struct varbuf_state *vs)
 

Detailed Description

Macro Definition Documentation

◆ varbuf_add_str

#define varbuf_add_str (   v,
 
)    varbuf_add_buf(v, s, strlen(s))

◆ VARBUF_INIT

#define VARBUF_INIT   { 0, 0, NULL }

◆ VARBUF_OBJECT

#define VARBUF_OBJECT   (struct varbuf)VARBUF_INIT

Function Documentation

◆ varbuf_add_buf()

void varbuf_add_buf ( struct varbuf v,
const void *  s,
size_t  size 
)

References buf, used, and varbuf_grow().

Referenced by conffderef(), and find_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ varbuf_add_char()

void varbuf_add_char ( struct varbuf v,
int  c 
)

References buf, used, and varbuf_grow().

Referenced by depisok(), find_command(), log_message(), pkg_infodb_get_file(), varbuf_add_arbfield(), varbuf_add_archqual(), varbuf_add_dir(), varbufdependency(), w_archives(), w_conffiles(), w_configversion(), w_name(), w_priority(), w_status(), w_trigaw(), w_trigpend(), w_version(), and writedb_records().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ varbuf_add_dir()

void varbuf_add_dir ( struct varbuf v,
const char *  dirname 
)

References buf, used, varbuf_add_char(), and varbuf_add_str.

Referenced by pkg_infodb_get_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ varbuf_destroy()

void varbuf_destroy ( struct varbuf v)

References buf, size, and used.

Referenced by check_breaks(), check_conflict(), deferred_configure(), describedepcon(), find_command(), parsedb_close(), pkg_format_show(), writedb_records(), and writerecord().

Here is the caller graph for this function:

◆ varbuf_detach()

char * varbuf_detach ( struct varbuf v)

References buf, size, and used.

Referenced by parsedb_load().

Here is the caller graph for this function:

◆ varbuf_dup_char()

void varbuf_dup_char ( struct varbuf v,
int  c,
size_t  n 
)

References buf, used, and varbuf_grow().

Here is the call graph for this function:

◆ varbuf_end_str()

void varbuf_end_str ( struct varbuf v)

References buf, used, and varbuf_grow().

Referenced by check_breaks(), conffderef(), deferred_configure(), describedepcon(), find_command(), log_message(), parsedb_load(), pkg_infodb_get_file(), predeppackage(), setupfnamevbs(), varbuf_get_str(), writedb_records(), and writerecord().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ varbuf_free()

void varbuf_free ( struct varbuf v)

References buf.

◆ varbuf_get_str()

const char * varbuf_get_str ( struct varbuf v)

References buf, and varbuf_end_str().

Here is the call graph for this function:

◆ varbuf_grow()

void varbuf_grow ( struct varbuf v,
size_t  need_size 
)

References _, buf, internerr, m_realloc(), ohshit(), size, and used.

Referenced by conffderef(), varbuf_add_buf(), varbuf_add_char(), varbuf_dup_char(), varbuf_end_str(), and varbuf_vprintf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ varbuf_init()

void varbuf_init ( struct varbuf v,
size_t  size 
)

References buf, m_malloc(), size, and used.

Referenced by file_slurp(), and varbuf_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ varbuf_map_char()

void varbuf_map_char ( struct varbuf v,
int  c_src,
int  c_dst 
)

References buf, and used.

◆ varbuf_new()

struct varbuf * varbuf_new ( size_t  size)

References m_malloc(), size, and varbuf_init().

Here is the call graph for this function:

◆ varbuf_printf()

int varbuf_printf ( struct varbuf v,
const char *  fmt,
  ... 
)

References args, and varbuf_vprintf().

Referenced by describedepcon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ varbuf_reset()

void varbuf_reset ( struct varbuf v)

References used.

Referenced by conffderef(), depisok(), find_command(), log_message(), pkg_infodb_get_file(), predeppackage(), and writedb_records().

Here is the caller graph for this function:

◆ varbuf_rollback()

void varbuf_rollback ( struct varbuf_state vs)

References varbuf_state::used, varbuf_state::v, and varbuf_trunc().

Referenced by setupfnamevbs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ varbuf_rollback_len()

size_t varbuf_rollback_len ( struct varbuf_state vs)

◆ varbuf_rollback_start()

const char * varbuf_rollback_start ( struct varbuf_state vs)

◆ varbuf_snapshot()

void varbuf_snapshot ( struct varbuf v,
struct varbuf_state vs 
)

◆ varbuf_trunc()

void varbuf_trunc ( struct varbuf v,
size_t  used_size 
)

References internerr, size, and used.

Referenced by conffderef(), and varbuf_rollback().

Here is the caller graph for this function:

◆ varbuf_vprintf()

int varbuf_vprintf ( struct varbuf v,
const char *  fmt,
va_list  va 
)

References _, args, buf, ohshite(), used, and varbuf_grow().

Referenced by compress_filter(), decompress_filter(), log_message(), and varbuf_printf().

Here is the call graph for this function:
Here is the caller graph for this function: