feat(ltm): memory safe errors; instance add var & nested functions
This commit is contained in:
parent
e058c107e2
commit
750bee27c7
6 changed files with 197 additions and 19 deletions
|
|
@ -21,6 +21,8 @@ typedef enum ltm_err {
|
|||
ltm_err_ok = 0,
|
||||
ltm_err_invalid_template,
|
||||
ltm_err_failed_alloc,
|
||||
ltm_err_not_found,
|
||||
ltm_err_wrong_block_type,
|
||||
} ltm_err;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,6 +28,12 @@ ltm_err ltm_template_compile(ltm_template **out, const char *template);
|
|||
ltm_err ltm_template_compile_n(ltm_template **out, const char *template,
|
||||
size_t len);
|
||||
|
||||
/**
|
||||
* Free the template instance. After freeing a template, no instances associated
|
||||
* with it are safe to use.
|
||||
*/
|
||||
void ltm_template_free(ltm_template *template);
|
||||
|
||||
/**
|
||||
* Represents a specific instance of a template.
|
||||
*/
|
||||
|
|
@ -39,8 +45,15 @@ typedef struct ltm_instance ltm_instance;
|
|||
ltm_err ltm_template_instantiate(ltm_instance **out,
|
||||
const ltm_template *template);
|
||||
|
||||
/**
|
||||
* Free the given instance, as well as all nested instances.
|
||||
*/
|
||||
void ltm_instance_free(ltm_instance *instance);
|
||||
|
||||
typedef enum ltm_instance_block_type {
|
||||
ltm_instance_block_type_buf = 0,
|
||||
ltm_instance_block_type_buf_owned,
|
||||
ltm_instance_block_type_nested,
|
||||
} ltm_instance_block_type;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue