element name cache API header file More...
#include <pthread.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | encache_t |
Element name cache structure. More... | |
Defines | |
#define | ENCACHE_INIT_SIZE 24 |
#define | ENCACHE_ADD_SIZE 8 |
Functions | |
encache_t * | encache_new (void) |
Create new element name cache. | |
void | encache_free (encache_t *cache) |
Free memory used by the element name cache. | |
SEXP_t * | encache_add (encache_t *cache, const char *name) |
Add a name to the cache. | |
SEXP_t * | encache_get (encache_t *cache, const char *name) |
Get a reference to an already cached S-exp object. | |
SEXP_t * | encache_ref (encache_t *cache, const char *name) |
Get a reference to a cached S-exp object. |
element name cache API header file
Add a name to the cache.
This will create a new S-exp object and return a reference to it. Reference count of such object will be 2 because the cache hold it's own reference to the object.
cache | element name cache | |
name | name string |
void encache_free | ( | encache_t * | cache | ) |
Free memory used by the element name cache.
The S-exp objects stored in the cache are also freed. However, if they are referenced somewhere else, the memory won't be freed, just the reference count will be decremented.
cache | the cache to be freed |
Get a reference to an already cached S-exp object.
If the object is not found in the cache, it won't be created and NULL will be returned to the caller.
cache | element name cache | |
name | name string |
encache_t* encache_new | ( | void | ) |
Create new element name cache.
Get a reference to a cached S-exp object.
If the object is not found in the cache, it will be created and the reference this newly created object will be returned to the caller.
cache | element name cache | |
name | name string |