libosmocore 1.11.0.26-c59d.202505072026
Osmocom core library
Loading...
Searching...
No Matches
osmo_strbuf Struct Reference

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

#include <utils.h>

Data Fields

charbuf
 Point to the start of a string buffer.
 
size_t len
 Total sizeof() the buffer buf points at.
 
charpos
 Current writing position in buf (end of the string written so far).
 
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.
 

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.

◆ len

size_t osmo_strbuf::len

Total sizeof() the buffer buf points at.

Referenced by _osmo_strbuf_char_count(), and _osmo_strbuf_remain().

◆ pos

char* osmo_strbuf::pos

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

Referenced by _osmo_strbuf_char_count(), and _osmo_strbuf_remain().


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