int xdict_set(xdict *d, void *key, void *val) { if (xdict_add(d, key, val) == XDICT_OK) return 1; xdictEntry *entry = xdict_find(d, key); xdictEntry auxentry = *entry; xdictSetHashVal(d, entry, val); xdictFreeEntryVal(d, &auxentry); return 0; }
/* add a dict into scws */ int scws_add_dict(scws_t s, const char *fpath, int mode) { xdict_t xx; if (mode & SCWS_XDICT_SET) { xdict_close(s->d); mode ^= SCWS_XDICT_SET; s->d = NULL; } xx = s->d; s->d = xdict_add(s->d, fpath, mode, s->mblen); return (xx == s->d ? -1 : 0); }