poser
A C framework for POsix SERvices
|
generic utility functions More...
#include <poser/decl.h>
#include <stddef.h>
Go to the source code of this file.
Functions | |
void * | PSC_malloc (size_t size) |
Allocate memory. | |
void * | PSC_realloc (void *ptr, size_t size) |
Re-allocate memory. | |
char * | PSC_copystr (const char *src) |
Copy a string. | |
char * | PSC_lowerstr (const char *src) |
Lowercase a string. | |
char * | PSC_joinstr (const char *delim, char **strings) |
Join multiple strings. | |
generic utility functions
char * PSC_copystr | ( | const char * | src | ) |
Copy a string.
This is similar to strdup(), but uses PSC_malloc() internally.
src | the string to copy |
char * PSC_joinstr | ( | const char * | delim, |
char ** | strings | ||
) |
Join multiple strings.
This joins an array of strings into a new string, putting a delimeter between all the elements.
delim | the delimeter |
strings | the strings to join, array must end with a NULL pointer |
char * PSC_lowerstr | ( | const char * | src | ) |
Lowercase a string.
This creates a copy of the string in all lowercase.
src | the string to copy |
void * PSC_malloc | ( | size_t | size | ) |
Allocate memory.
This is a wrapper around malloc() that ensures only valid pointers are returned. In case of an allocation error, PSC_Service_panic() is called.
size | size of the memory to allocate |
void * PSC_realloc | ( | void * | ptr, |
size_t | size | ||
) |
Re-allocate memory.
This is a wrapper around realloc() that ensures only valid pointers are returned. In case of an allocation error, PSC_Service_panic() is called.
ptr | the previously allocated memory |
size | new size for the allocated memory |