GNUnet  0.17.6
Functions
buffer.c File Reference

Common buffer management functions. More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_buffer_lib.h"
Include dependency graph for buffer.c:

Go to the source code of this file.

Functions

void GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf, size_t capacity)
 Initialize a buffer with the given capacity. More...
 
void GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, size_t n)
 Make sure that at least n bytes remaining in the buffer. More...
 
void GNUNET_buffer_write (struct GNUNET_Buffer *buf, const char *data, size_t len)
 Write bytes to the buffer. More...
 
void GNUNET_buffer_write_str (struct GNUNET_Buffer *buf, const char *str)
 Write a 0-terminated string to a buffer, excluding the 0-terminator. More...
 
char * GNUNET_buffer_reap_str (struct GNUNET_Buffer *buf)
 Clear the buffer and return the string it contained. More...
 
void * GNUNET_buffer_reap (struct GNUNET_Buffer *buf, size_t *size)
 Clear the buffer and return its contents. More...
 
void GNUNET_buffer_clear (struct GNUNET_Buffer *buf)
 Free the backing memory of the given buffer. More...
 
void GNUNET_buffer_write_path (struct GNUNET_Buffer *buf, const char *str)
 Write a path component to a buffer, ensuring that there is exactly one slash between the previous contents of the buffer and the new string. More...
 
void GNUNET_buffer_write_fstr (struct GNUNET_Buffer *buf, const char *fmt,...)
 Write a 0-terminated formatted string to a buffer, excluding the 0-terminator. More...
 
void GNUNET_buffer_write_vfstr (struct GNUNET_Buffer *buf, const char *fmt, va_list args)
 Write a 0-terminated formatted string to a buffer, excluding the 0-terminator. More...
 
void GNUNET_buffer_write_data_encoded (struct GNUNET_Buffer *buf, const void *data, size_t data_len)
 Write data encoded via GNUNET_STRINGS_data_to_string to the buffer. More...
 

Detailed Description

Common buffer management functions.

Author
Florian Dold

Definition in file buffer.c.

Function Documentation

◆ GNUNET_buffer_write_fstr()

void GNUNET_buffer_write_fstr ( struct GNUNET_Buffer buf,
const char *  fmt,
  ... 
)

Write a 0-terminated formatted string to a buffer, excluding the 0-terminator.

Grows the buffer if necessary.

Parameters
bufthe buffer to write to
fmtformat string
...format arguments

Definition at line 209 of file buffer.c.

210 {
211  va_list args;
212 
213  va_start (args, fmt);
215  va_end (args);
216 }
static char buf[2048]
void GNUNET_buffer_write_vfstr(struct GNUNET_Buffer *buf, const char *fmt, va_list args)
Write a 0-terminated formatted string to a buffer, excluding the 0-terminator.
Definition: buffer.c:230

References consensus-simulation::args, buf, and GNUNET_buffer_write_vfstr().

Here is the call graph for this function: