/* drop reference, free if none left */ void strpool_decref(struct PStr *s) { struct StrPool *sp; if (!s) return; Assert(s->refcnt > 0); sp = s->pool; pthread_mutex_lock(&sp->mutex); s->refcnt--; if (s->refcnt > 0){ pthread_mutex_unlock(&sp->mutex); return; } /* remove */ sp->count--; cbtree_delete(sp->tree, s->str, s->len); free_str(NULL, s); pthread_mutex_unlock(&sp->mutex); }
bool mdict_del_key(struct MDict *dict, const char *key, unsigned klen) { return cbtree_delete(dict->tree, key, klen); }