cstring.h(3)
| cstring.h(3) | Library Functions Manual | cstring.h(3) |
NAME
cstring.h -
SYNOPSIS
#include <stdlib.h>
Data Structures
struct __cstring
Typedefs
typedef struct __cstring CSTRING
Functions
void sgrowsize (size_t s)
CSTRING * snew (size_t s)
CSTRING * sadd (CSTRING *s, char *a)
CSTRING * saddch (CSTRING *s, char a)
CSTRING * strim (CSTRING *s)
char * toCharPtr (CSTRING *s)
void sempty (CSTRING *s)
void sdestroy (CSTRING *s)
Typedef Documentation
typedef struct __cstring CSTRING cstring.h : c string library to make Ron happy. Wrapper around plain C strings that handles automatically growing the string as data is concattenated to the end. (note: this is an improved version of cstring from supermon. Migrate it into that library eventually... )
-matt sottile Structure wrapping the character pointer and size counters (allocated vs. actual used).
Function Documentation
CSTRING* sadd (CSTRING *s, char *a) Concatenate the second argument to the CSTRING passed in the first. The second argument must be a pointer to a null terminated string. A NULL return value indicates that something went wrong and that sexp_errno should be checked for the cause. The contents of s are left alone. As such, the caller should check the pointer returned before overwriting the value of s, as this may result in a memory leak if an error condition occurs.
CSTRING* saddch (CSTRING *s, chara) Append a character to the end of the CSTRING. A NULL return value indicates that something went wrong and that sexp_errno should be checked for the cause. The contents of s are left alone. As such, the caller should check the pointer returned before overwriting the value of s, as this may result in a memory leak if an error condition occurs.
void sdestroy (CSTRING *s) Destroy the CSTRING struct and the data it points at.
void sempty (CSTRING *s) Set the current length to zero, effectively dumping the string without deallocating it so we can use it later without reallocating any memory.
void sgrowsize (size_ts) Set the growth size. Values less than one are ignored.
CSTRING* snew (size_ts) Allocate a new CSTRING of the given size. A NULL return value indicates that something went wrong and that sexp_errno should be checked for the cause.
CSTRING* strim (CSTRING *s) Trim the allocated memory to precisely the string length plus one char to hold the null terminator A NULL return value indicates that something went wrong and that sexp_errno should be checked for the cause. The contents of s are left alone. As such, the caller should check the pointer returned before overwriting the value of s, as this may result in a memory leak if an error condition occurs.
char* toCharPtr (CSTRING *s) Return the base pointer of the CSTRING. NULL either means the base pointer was null, or the CSTRING itself was NULL.
Author
Generated automatically by Doxygen for Small, Fast S-Expression Library from the source code.
| Thu Nov 21 2013 | Small, Fast S-Expression Library |
