Crossfire Server, Branches 1.12
R18729
|
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "global.h"
#include "libproto.h"
#include "stringbuffer.h"
Go to the source code of this file.
Data Structures | |
struct | StringBuffer |
Functions | |
void | stringbuffer_append_printf (StringBuffer *sb, const char *format,...) |
void | stringbuffer_append_string (StringBuffer *sb, const char *str) |
void | stringbuffer_append_stringbuffer (StringBuffer *sb, const StringBuffer *sb2) |
static void | stringbuffer_ensure (StringBuffer *sb, size_t len) |
char * | stringbuffer_finish (StringBuffer *sb) |
sstring | stringbuffer_finish_shared (StringBuffer *sb) |
StringBuffer * | stringbuffer_new (void) |
void stringbuffer_append_printf | ( | StringBuffer * | sb, |
const char * | format, | ||
... | |||
) |
Append a formatted string to a string buffer instance.
sb | The string buffer to modify. |
format | The format string to append. |
Definition at line 106 of file stringbuffer.c.
References StringBuffer::buf, StringBuffer::pos, stringbuffer_ensure(), and vsnprintf.
Referenced by cost_string_from_value(), dump_object(), query_cost_string(), and real_money_value().
void stringbuffer_append_string | ( | StringBuffer * | sb, |
const char * | str | ||
) |
Append a string to a string buffer instance.
sb | The string buffer to modify. |
str | The string to append. |
Definition at line 97 of file stringbuffer.c.
References StringBuffer::buf, StringBuffer::pos, and stringbuffer_ensure().
Referenced by cost_string_from_value(), dump_object(), and query_cost_string().
void stringbuffer_append_stringbuffer | ( | StringBuffer * | sb, |
const StringBuffer * | sb2 | ||
) |
Append the contents of a string buffer instance to another string buffer instance.
sb | The string buffer to modify. |
sb2 | The string buffer to append; it must be different from sb. |
Definition at line 133 of file stringbuffer.c.
References StringBuffer::buf, StringBuffer::pos, and stringbuffer_ensure().
|
static |
Make sure that at least len
bytes are available in the passed string buffer.
sb | The string buffer to modify. |
len | The number of bytes to allocate. |
Definition at line 139 of file stringbuffer.c.
References StringBuffer::buf, fatal(), OUT_OF_MEMORY, StringBuffer::pos, and StringBuffer::size.
Referenced by stringbuffer_append_printf(), stringbuffer_append_string(), and stringbuffer_append_stringbuffer().
char* stringbuffer_finish | ( | StringBuffer * | sb | ) |
Deallocate the string buffer instance and return the string.
The passed string buffer must not be accessed afterwards.
sb | The string buffer to deallocate. |
free()
on it. Definition at line 78 of file stringbuffer.c.
References StringBuffer::buf, and StringBuffer::pos.
Referenced by add_one_item(), animate_object(), can_pay(), command_diff(), command_dump(), command_dumpbelow(), describe_shop(), dump_all_archetypes(), dump_all_objects(), examine(), free_object2(), gate_type_process(), get_payment(), insert_ob_in_map(), insert_ob_in_ob(), pick_up_object(), process_events(), remove_ob(), sell_item(), SockList_AddStringBuffer(), START_TEST(), and stringbuffer_finish_shared().
sstring stringbuffer_finish_shared | ( | StringBuffer * | sb | ) |
Deallocate the string buffer instance and return the string as a shared string.
The passed string buffer must not be accessed afterwards.
sb | The string buffer to deallocate. |
free_string()
on it. Definition at line 87 of file stringbuffer.c.
References add_string(), and stringbuffer_finish().
StringBuffer* stringbuffer_new | ( | void | ) |
Create a new string buffer.
Definition at line 64 of file stringbuffer.c.
References StringBuffer::buf, fatal(), OUT_OF_MEMORY, StringBuffer::pos, and StringBuffer::size.
Referenced by add_one_item(), animate_object(), command_diff(), command_dump(), command_dumpbelow(), cost_string_from_value(), dump_all_archetypes(), dump_all_objects(), free_object2(), gate_type_process(), insert_ob_in_map(), insert_ob_in_ob(), process_events(), query_cost_string(), remove_ob(), and START_TEST().