dpkg 1.22.7-3-g89f48
Loading...
Searching...
No Matches
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_set_str(v, s)   varbuf_set_buf(v, s, strlen(s))
 
#define varbuf_set_strn(v, s, n)   varbuf_set_buf(v, s, strnlen(s, n))
 
#define varbuf_add_str(v, s)   varbuf_add_buf(v, s, strlen(s))
 
#define varbuf_add_strn(v, s, n)   varbuf_add_buf(v, s, strnlen(s, n))
 

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)
 
const char * varbuf_str (struct varbuf *v)
 
void varbuf_set_varbuf (struct varbuf *v, struct varbuf *other)
 
void varbuf_set_buf (struct varbuf *v, const void *buf, size_t size)
 
void varbuf_add_varbuf (struct varbuf *v, const struct varbuf *other)
 
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)
 
bool varbuf_has_prefix (struct varbuf *v, struct varbuf *prefix)
 
bool varbuf_has_suffix (struct varbuf *v, struct varbuf *suffix)
 
void varbuf_trim_varbuf_prefix (struct varbuf *v, struct varbuf *prefix)
 
void varbuf_trim_char_prefix (struct varbuf *v, int prefix)
 
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_add_strn

#define varbuf_add_strn (   v,
  s,
 
)    varbuf_add_buf(v, s, strnlen(s, n))

◆ VARBUF_INIT

#define VARBUF_INIT   { 0, 0, NULL }

◆ VARBUF_OBJECT

#define VARBUF_OBJECT   (struct varbuf)VARBUF_INIT

◆ varbuf_set_str

#define varbuf_set_str (   v,
 
)    varbuf_set_buf(v, s, strlen(s))

◆ varbuf_set_strn

#define varbuf_set_strn (   v,
  s,
 
)    varbuf_set_buf(v, s, strnlen(s, n))

Function Documentation

◆ varbuf_add_buf()

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

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

Referenced by pkg_format_print(), pkg_source_version(), and varbuf_set_buf().

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 command_in_path(), commandfd(), depisok(), get_force_string(), log_message(), pkg_infodb_get_file(), setselections(), statusfd_send(), trigproc(), varbuf_add_arbfield(), varbuf_add_archqual(), varbuf_add_dir(), varbufdependency(), varbufversion(), w_architecture(), w_archives(), w_booleandefno(), w_charfield(), w_conffiles(), w_configversion(), w_dependency(), w_multiarch(), w_name(), w_priority(), w_section(), w_status(), w_trigaw(), w_trigpend(), w_version(), and writedb_stanzas().

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 modstatdb_init(), pkg_infodb_foreach(), and pkg_infodb_get_file().

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

◆ varbuf_add_varbuf()

void varbuf_add_varbuf ( struct varbuf v,
const struct varbuf other 
)

References buf, used, and varbuf_grow().

Referenced by conffderef(), and dependencies_ok().

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

◆ varbuf_destroy()

void varbuf_destroy ( struct varbuf v)

◆ varbuf_detach()

char * varbuf_detach ( struct varbuf v)

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

Referenced by dpkg_get_pid_execname(), get_force_string(), and parsedb_load().

Here is the call graph for this function:
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_free()

void varbuf_free ( struct varbuf v)

References buf.

◆ varbuf_grow()

void varbuf_grow ( struct varbuf v,
size_t  need_size 
)

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

Referenced by file_getcwd(), file_readlink(), read_info(), varbuf_add_buf(), varbuf_add_char(), varbuf_add_varbuf(), varbuf_dup_char(), and varbuf_vprintf().

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

◆ varbuf_has_prefix()

bool varbuf_has_prefix ( struct varbuf v,
struct varbuf prefix 
)

References buf, and used.

Referenced by varbuf_trim_varbuf_prefix().

Here is the caller graph for this function:

◆ varbuf_has_suffix()

bool varbuf_has_suffix ( struct varbuf v,
struct varbuf suffix 
)

References buf, and used.

◆ varbuf_init()

void varbuf_init ( struct varbuf v,
size_t  size 
)

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

Referenced by file_slurp(), modstatdb_init(), modstatdb_open(), 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.

Referenced by statusfd_send().

Here is the caller graph for this function:

◆ 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(), modstatdb_checkpoint(), and varbufversion().

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 buf, and used.

Referenced by archivefiles(), commandfd(), dependencies_ok(), depisok(), file_getcwd(), file_readlink(), pkg_format_print(), pkg_infodb_get_file(), predeppackage(), read_info(), setselections(), statusfd_send(), trigproc(), varbuf_set_buf(), versiondescribe(), and writedb_stanzas().

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 modstatdb_checkpoint(), pkg_infodb_foreach(), and 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)

References internerr, used, varbuf_state::used, and varbuf_state::v.

Referenced by modstatdb_checkpoint().

Here is the caller graph for this function:

◆ varbuf_rollback_start()

const char * varbuf_rollback_start ( struct varbuf_state vs)

References buf, internerr, varbuf_state::used, varbuf_state::v, and varbuf_str().

Referenced by modstatdb_checkpoint().

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

◆ varbuf_set_buf()

void varbuf_set_buf ( struct varbuf v,
const void *  buf,
size_t  size 
)

References buf, size, varbuf_add_buf(), and varbuf_reset().

Referenced by command_in_path(), f_dependency(), and varbuf_set_varbuf().

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

◆ varbuf_set_varbuf()

void varbuf_set_varbuf ( struct varbuf v,
struct varbuf other 
)

References buf, used, and varbuf_set_buf().

Here is the call graph for this function:

◆ varbuf_snapshot()

void varbuf_snapshot ( struct varbuf v,
struct varbuf_state vs 
)

References used, varbuf_state::used, and varbuf_state::v.

Referenced by archivefiles(), modstatdb_init(), and pkg_infodb_foreach().

Here is the caller graph for this function:

◆ varbuf_str()

const char * varbuf_str ( struct varbuf v)

References buf.

Referenced by check_breaks(), check_conflict(), conffderef(), deferred_configure(), deferred_remove(), dependencies_ok(), pkg_format_print(), pkg_source_version(), setselections(), trigproc(), varbuf_rollback_start(), write_stanza(), and writedb_stanzas().

Here is the caller graph for this function:

◆ varbuf_trim_char_prefix()

void varbuf_trim_char_prefix ( struct varbuf v,
int  prefix 
)

References buf, used, and varbuf_trunc().

Here is the call graph for this function:

◆ varbuf_trim_varbuf_prefix()

void varbuf_trim_varbuf_prefix ( struct varbuf v,
struct varbuf prefix 
)

References buf, used, varbuf_has_prefix(), and varbuf_trunc().

Here is the call graph for this function:

◆ varbuf_trunc()

void varbuf_trunc ( struct varbuf v,
size_t  used_size 
)

References buf, internerr, size, and used.

Referenced by conffderef(), file_getcwd(), file_readlink(), read_info(), varbuf_rollback(), varbuf_trim_char_prefix(), and varbuf_trim_varbuf_prefix().

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(), statusfd_send(), and varbuf_printf().

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