VTK
|
#include <stddef.h>
Go to the source code of this file.
Classes | |
struct | _StringCache |
StringCache provides a simple way of allocating strings centrally. More... | |
Typedefs | |
typedef struct _StringCache | StringCache |
StringCache provides a simple way of allocating strings centrally. | |
Functions | |
void | vtkParse_InitStringCache (StringCache *cache) |
Initialize the string cache. | |
char * | vtkParse_NewString (StringCache *cache, size_t n) |
Alocate a new string from the cache. | |
const char * | vtkParse_CacheString (StringCache *cache, const char *cp, size_t n) |
Cache a string so that it can then be used in the vtkParse data structures. | |
void | vtkParse_FreeStringCache (StringCache *cache) |
Free all strings that were created with vtkParse_NewString() or with vtkParse_CacheString(). |
typedef struct _StringCache StringCache |
StringCache provides a simple way of allocating strings centrally.
It eliminates the need to allocate and free each individual strings, which makes the code simpler and more efficient.
void vtkParse_InitStringCache | ( | StringCache * | cache | ) |
Initialize the string cache.
char* vtkParse_NewString | ( | StringCache * | cache, |
size_t | n | ||
) |
Alocate a new string from the cache.
A total of n+1 bytes will be allocated, to leave room for null.
const char* vtkParse_CacheString | ( | StringCache * | cache, |
const char * | cp, | ||
size_t | n | ||
) |
Cache a string so that it can then be used in the vtkParse data structures.
The string will last until the application exits. At most 'n' chars will be copied, and the string will be terminated. If a null pointer is provided, then a null pointer will be returned.
void vtkParse_FreeStringCache | ( | StringCache * | cache | ) |
Free all strings that were created with vtkParse_NewString() or with vtkParse_CacheString().