libosmocore 1.9.0.196-9975
Osmocom core library
osmo_strbuf Struct Reference

State for OSMO_STRBUF_APPEND() and OSMO_STRBUF_PRINTF(). More...

#include <utils.h>

Data Fields

char * buf
 Point to the start of a string buffer. More...
 
size_t len
 Total sizeof() the buffer buf points at. More...
 
char * pos
 Current writing position in buf (end of the string written so far). More...
 
size_t chars_needed
 After all OSMO_STRBUF_APPEND operations, reflects the total number of characters that would be written had buf been large enough. More...
 

Detailed Description

State for OSMO_STRBUF_APPEND() and OSMO_STRBUF_PRINTF().

See there for examples.

Field Documentation

◆ buf

◆ chars_needed

size_t osmo_strbuf::chars_needed

After all OSMO_STRBUF_APPEND operations, reflects the total number of characters that would be written had buf been large enough.

Like snprintf()'s return value, this does not include the terminating nul character. Hence, to allocate an adequately sized buffer, add 1 to this number.

Referenced by _osmo_escape_str_buf(), _osmo_quote_str_buf(), osmo_int_to_float_str_buf(), osmo_strbuf_added_tail(), osmo_strbuf_drop_tail(), and osmo_use_count_to_str_buf().

◆ len

size_t osmo_strbuf::len

Total sizeof() the buffer buf points at.

Referenced by _osmo_strbuf_char_count(), _osmo_strbuf_remain(), and osmo_strbuf_added_tail().

◆ pos

char* osmo_strbuf::pos

Current writing position in buf (end of the string written so far).

Referenced by _osmo_strbuf_char_count(), _osmo_strbuf_remain(), _output_buf(), osmo_strbuf_added_tail(), and osmo_strbuf_drop_tail().


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