16 #ifndef JM_NAMED_PTR_H 17 #define JM_NAMED_PTR_H 71 #define jm_diff_named(a, b) strcmp(a.name,b.name)
void * jm_voidp
A void pointer.
#define jm_vector_foreach_c(T)
#define jm_vector_free(T)
#define jm_vector_free_data(T)
jm_vector_declare_template(jm_named_ptr) jm_define_comp_f(jm_compare_named
Helper to construct comparison operation.
jm_vector(JM_TEMPLATE_INSTANCE_TYPE)*jm_vector_alloc(JM_TEMPLATE_INSTANCE_TYPE)(size_t size
jm_string name
Object pointer.
struct jm_named_ptr jm_named_ptr
Name and object pointer pair.
static jm_diff_named void jm_named_vector_free_data(jm_vector(jm_named_ptr)*v)
Release the data allocated by the items in a vector and then clears the memory used by the vector as ...
static void jm_named_vector_free(jm_vector(jm_named_ptr)*v)
Release the data allocated by the items in a vector and then clears the memory used by the vector as ...
#define jm_define_comp_f(F, T, COMPAR_OP)
A conveniece macro for comparison function definition.
Name and object pointer pair.
const char * jm_string
A constant string.
#define jm_diff_named(a, b)
The callbacks struct is sent to all the modules in the library.
static void jm_named_free(jm_named_ptr np, jm_callbacks *c)
Free the memory allocated for the object pointed by jm_named_ptr.
jm_named_ptr jm_named_alloc(jm_string name, size_t size, size_t nameoffset, jm_callbacks *c)
Allocate memory for the object and the name string and sets pointer to it packed together with the na...
jm_named_ptr jm_named_alloc_v(jm_vector(char)*name, size_t size, size_t nameoffset, jm_callbacks *c)
Same as jm_named_alloc() but name is given as a jm_vector(char) pointer.
jm_free_f free
Free-allocated memory.