Store *open_fs_store(const char *pathname) { Store *store = NULL; mutex_lock(&stores_mutex); if (!stores) { stores = h_new_str(NULL, (free_ft)fs_destroy); register_for_cleanup(stores, (free_ft)h_destroy); } store = (Store *)h_get(stores, pathname); if (store) { mutex_lock(&store->mutex); store->ref_cnt++; mutex_unlock(&store->mutex); } else { store = fs_store_new(pathname); h_set(stores, store->dir.path, store); } mutex_unlock(&stores_mutex); return store; }
void symbol_init() { symbol_table = h_new_str(free, NULL); register_for_cleanup(symbol_table, (free_ft)&h_destroy); }