Home | History | Annotate | Download | only in citrus

Lines Matching defs:cm

189 mapper_close(struct _citrus_mapper *cm)
191 if (cm->cm_module) {
192 if (cm->cm_ops) {
193 if (cm->cm_closure)
194 (*cm->cm_ops->mo_uninit)(cm);
195 free(cm->cm_ops);
197 _citrus_unload_module(cm->cm_module);
199 free(cm->cm_traits);
200 free(cm);
214 struct _citrus_mapper *cm;
218 cm = malloc(sizeof(*cm));
219 if (!cm)
222 cm->cm_module = NULL;
223 cm->cm_ops = NULL;
224 cm->cm_closure = NULL;
225 cm->cm_traits = NULL;
226 cm->cm_refcount = 0;
227 cm->cm_key = NULL;
230 ret = _citrus_load_module(&cm->cm_module, module);
236 _citrus_find_getops(cm->cm_module, module, "mapper");
241 cm->cm_ops = malloc(sizeof(*cm->cm_ops));
242 if (!cm->cm_ops) {
246 ret = (*getops)(cm->cm_ops, sizeof(*cm->cm_ops),
251 if (!cm->cm_ops->mo_init ||
252 !cm->cm_ops->mo_uninit ||
253 !cm->cm_ops->mo_convert ||
254 !cm->cm_ops->mo_init_state) {
260 cm->cm_traits = malloc(sizeof(*cm->cm_traits));
261 if (cm->cm_traits == NULL) {
266 ret = (*cm->cm_ops->mo_init)(ma, cm, ma->ma_dir,
269 cm->cm_traits, sizeof(*cm->cm_traits));
273 *rcm = cm;
278 mapper_close(cm);
308 match_func(struct _citrus_mapper *cm, const char *key)
310 return strcmp(cm->cm_key, key);
325 struct _citrus_mapper *cm;
332 _CITRUS_HASH_SEARCH(&ma->ma_cache, cm, cm_entry, match_func, mapname,
334 if (cm) {
336 cm->cm_refcount++;
337 *rcm = cm;
349 ret = mapper_open(ma, &cm, module, variable);
352 cm->cm_key = strdup(mapname);
353 if (cm->cm_key == NULL) {
356 _mapper_close(cm);
361 cm->cm_refcount = 1;
362 _CITRUS_HASH_INSERT(&ma->ma_cache, cm, cm_entry, hashval);
364 *rcm = cm;
376 _citrus_mapper_close(struct _citrus_mapper *cm)
378 if (cm) {
380 if (cm->cm_refcount == REFCOUNT_PERSISTENT)
382 if (cm->cm_refcount > 0) {
383 if (--cm->cm_refcount > 0)
385 _CITRUS_HASH_REMOVE(cm, cm_entry);
386 free(cm->cm_key);
389 mapper_close(cm);
401 _citrus_mapper_set_persistent(struct _citrus_mapper * __restrict cm)
404 cm->cm_refcount = REFCOUNT_PERSISTENT;