/* Cleans up global resources */ void delta_cleanup() { if (hashes_created) { rhash_clear(md5_hash); rhash_clear(delta_hash); rhash_clear(prop_hash); hashes_created = 0; } }
/* Closes the storage and sends it into oblivion */ int mukv_close(mukv_t *kv) { rhash_clear(kv->index); /* Goodbye, data */ if (fclose(kv->file) != 0 || unlink(kv->path) != 0) { return errno; } return 0; }
static VALUE rhash_replace(VALUE hash, SEL sel, VALUE hash2) { rhash_modify(hash); hash2 = to_hash(hash2); if (hash == hash2) { return hash; } // Copy RubyHash properties. if (IS_RHASH(hash2)) { if (RHASH(hash2)->tbl->type == &identhash) { RHASH(hash)->tbl->type = &identhash; } GC_WB(&RHASH(hash)->ifnone, RHASH(hash2)->ifnone); RHASH(hash)->has_proc_default = RHASH(hash2)->has_proc_default; } rhash_clear(hash, 0); rb_hash_foreach(hash2, replace_i, hash); return hash; }