|
symbolic4
|
#include "symbolic4.h"Go to the source code of this file.
Functions | |
| void * | smart_alloc (uint8_t length, size_t size) |
| Allocates and keeps track of memory. More... | |
| void * | smart_realloc (void *source, uint8_t length, size_t size) |
| Resizes a pointer. More... | |
| void | smart_free (void *pointer) |
| Frees a pointer. More... | |
| void | smart_free_all (void) |
| Frees all pointers. More... | |
| uint8_t | set_error (error_domain domain, error_identifier identifier, const char *body) |
Sets current_error to the arguments provided. More... | |
| void | set_handle_unrecoverable_error (error_domain domain, error_identifier identifier, const char *body) |
| Handles severe and unrecoverable errors. More... | |
| double | uintmax_max_value (void) |
| char * | string_to_lower (const char *string) |
| Converts a string to lowercase. More... | |
| void | itoa (char *buffer, uintmax_t source) |
| void | dtoa (char *buffer, uint8_t length, double source) |
Variables | |
| error | current_error |
| void ** | allocated_pointers |
| bool | smart_alloc_is_recording = true |
| void dtoa | ( | char * | buffer, |
| uint8_t | length, | ||
| double | source | ||
| ) |
Definition at line 233 of file foundation.c.
| void itoa | ( | char * | buffer, |
| uintmax_t | source | ||
| ) |
Definition at line 216 of file foundation.c.
| uint8_t set_error | ( | error_domain | domain, |
| error_identifier | identifier, | ||
| const char * | body | ||
| ) |
Sets current_error to the arguments provided.
| [in] | domain | |
| [in] | identifier | |
| [in] | body |
RETS_ERROR Definition at line 152 of file foundation.c.
| void set_handle_unrecoverable_error | ( | error_domain | domain, |
| error_identifier | identifier, | ||
| const char * | body | ||
| ) |
Handles severe and unrecoverable errors.
This function serves as the last resort when the program encounters exceptionally severe errors, such as a failed memory allocation, from which it can't recover itself. The
loop may be replaced with system-specific error handling.
| [in] | domain | The error domain. |
| [in] | identifier | The error identifier. |
| [in] | body | The error body. |
Definition at line 181 of file foundation.c.
| void* smart_alloc | ( | uint8_t | length, |
| size_t | size | ||
| ) |
Allocates and keeps track of memory.
The pointer to the allocated memory is stored in the allocated_pointers array.
allocated_pointers array must be initialized with NULL, or else the loop won't work.set_handle_unrecoverable_error() is called.| [in] | length | The length/count of the elements. |
| [in] | size | The size of one element (see sizeof()). |
Definition at line 59 of file foundation.c.
| void smart_free | ( | void * | pointer | ) |
Frees a pointer.
This function frees a pointer and sets its corresponding entry in the allocated_pointers array to NULL.
| [in] | pointer | The pointer to be freed. |
Definition at line 112 of file foundation.c.
| void smart_free_all | ( | void | ) |
Frees all pointers.
This function frees all pointers allocated with smart_alloc() by iteratively calling smart_free().
Definition at line 133 of file foundation.c.
| void* smart_realloc | ( | void * | source, |
| uint8_t | length, | ||
| size_t | size | ||
| ) |
Resizes a pointer.
The resized pointer to the allocated memory is stored in the allocated_pointers array.
| [in] | source | The pointer to be resized. |
| [in] | length | The new length/count of the elements. |
| [in] | size | The size of one element (see sizeof()). |
Definition at line 86 of file foundation.c.
| char* string_to_lower | ( | const char * | string | ) |
Converts a string to lowercase.
This function copies the source string and converts that copy character-wise to lowercase. The resulting string must be freed.
| [in] | string | The string to convert. |
Definition at line 206 of file foundation.c.
| double uintmax_max_value | ( | void | ) |
Definition at line 188 of file foundation.c.
| void** allocated_pointers |
Definition at line 29 of file foundation.c.
| error current_error |
Definition at line 28 of file foundation.c.
| bool smart_alloc_is_recording = true |
Definition at line 30 of file foundation.c.