Loading...
Searching...
No Matches
osmo_strbuf Struct Reference
General-purpose utility functions

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.
size_t | len
| Total sizeof() the buffer buf points at.
char * | pos
| 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

char* osmo_strbuf::buf

Point to the start of a string buffer.

Referenced by _osmo_escape_str_buf(), _osmo_quote_str_buf(), _osmo_strbuf_char_count(), _osmo_strbuf_remain(), _output_buf(), osmo_escape_cstr_buf(), osmo_escape_str_buf2(), osmo_escape_str_buf3(), osmo_int_to_float_str_buf(), osmo_quote_cstr_buf(), osmo_quote_str_buf(), osmo_quote_str_buf2(), osmo_quote_str_buf3(), osmo_str_tolower_c(), osmo_str_toupper_c(), and osmo_use_count_to_str_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:

- include/osmocom/core/utils.h