cur_t *cur_new(void) { cur_t *cur; int id = id_new(); if(id == -1) return NULL; if((cur = (cur_t*)malloc(sizeof(cur_t))) == NULL) { id_free(id); return NULL; } memset(cur, 0, sizeof(cur_t)); cur->id = id; if(cur_search(cur->id)) { free(cur); id_free(id); return NULL; } //cur->Zzz = LUA_NOREF; cur_insert(cur); return cur; }
IdentityData_t *id_create (Identity_t id, DDS_ReturnCode_t *ret) { IdentityData_t *p; unsigned h; p = id_lookup (id, &h); if (p) { *ret = DDS_RETCODE_OK; return (p); } p = id_new (id); if (!p) { *ret = DDS_RETCODE_OUT_OF_RESOURCES; return (NULL); } id_add (p, h); return (p); }