/* clear a hash table of the form GncGUID --> EventInfo, where * both keys and values are g_malloced */ static void clear_event_hash (GHashTable *hash) { if (hash == NULL) return; g_hash_table_foreach_remove (hash, destroy_event_hash_helper, NULL); }
static void userlist_dispose (GObject *object) { Userlist *userlist = (Userlist*) object; g_hash_table_foreach_remove (userlist->stores, (GHRFunc) destroy_store, NULL); parent_class->dispose(object); }
/* this sucks -- too slow */ static void empty_hash_table(void) { if (!stat_hash) return; g_hash_table_foreach_remove(stat_hash, delete_hash_entry, NULL); }
void client_delete_all(void) { if(g_hash_table_size(ccm_hashclient)) { g_hash_table_foreach_remove(ccm_hashclient, destroy_func, NULL); } return; }
void hippo_dbus_model_name_gone(const char *name) { DDMDataModel *model = hippo_app_get_data_model(hippo_get_app()); DataClientMap *client_map = data_client_map_get(model); g_hash_table_foreach_remove(client_map->clients, name_gone_foreach, (gpointer)name); }
static void _cairo_dock_stop_application_manager (void) { s_bAppliManagerIsRunning = FALSE; cairo_dock_remove_all_applis_from_class_table (); // enleve aussi les indicateurs. g_hash_table_foreach_remove (s_hAppliIconsTable, (GHRFunc) _remove_one_appli, NULL); // libere toutes les icones d'appli. }
static void rb_removable_media_manager_source_deleted_cb (RBSource *source, RBRemovableMediaManager *mgr) { RBRemovableMediaManagerPrivate *priv = GET_PRIVATE (mgr); rb_debug ("removing source %p", source); g_hash_table_foreach_remove (priv->volume_mapping, (GHRFunc)remove_by_source, source); g_hash_table_foreach_remove (priv->mount_mapping, (GHRFunc)remove_by_source, source); g_hash_table_foreach_remove (priv->device_mapping, (GHRFunc)remove_by_source, source); priv->sources = g_list_remove (priv->sources, source); }
/* * Destroys the caches and the flickcurl connection */ void flickr_cache_kill() { /* Wipe existing cache */ pthread_rwlock_wrlock(&cache_lock); pthread_rwlock_destroy(&cache_lock); g_hash_table_foreach_remove(photoset_ht, free_photoset_ht, NULL); g_hash_table_destroy(photoset_ht); flickr_kill(); }
static gboolean gst_mpegts_base_handle_eos (MpegTSBase * base) { g_hash_table_foreach_remove (base->programs, (GHRFunc) remove_each_program, base); /* finally remove */ return TRUE; }
void refresh_database(dbi_conn conn) { dbi_result result; char qry[1024]; sprintf(qry, "SELECT pr_pop3_def.id, pr_pop3_def.domid, pr_pop3_def.tblid, pr_realm.name, " " pr_pop3_def.ipaddress, pr_pop3_def.username, " " pr_pop3_def.password, " " pr_pop3_def.yellow, pr_pop3_def.red " "FROM pr_pop3_def, pr_realm " "WHERE pr_pop3_def.id > 1 and pr_pop3_def.disable <> 'yes'" " and pr_pop3_def.pgroup = '%d' and pr_realm.id = pr_pop3_def.domid", (unsigned)OPT_VALUE_GROUPID); result = db_query(conn, 1, qry); if (!result) { return; } while (dbi_result_next_row(result)) { int id; struct probedef *probe; id = dbi_result_get_uint(result, "id"); probe = g_hash_table_lookup(cache, &id); if (!probe) { probe = g_malloc0(sizeof(struct probedef)); if (dbi_result_get_uint(result, "domid") > 1) { probe->probeid = dbi_result_get_uint(result, "tblid"); probe->realm=strdup(dbi_result_get_string(result, "name")); } else { probe->probeid = probe->id; } g_hash_table_insert(cache, guintdup(id), probe); } if (probe->ipaddress) g_free(probe->ipaddress); probe->ipaddress = dbi_result_get_string_copy(result, "ipaddress"); if (probe->username) g_free(probe->username); probe->username = dbi_result_get_string_copy(result, "username"); if (probe->password) g_free(probe->password); probe->password = dbi_result_get_string_copy(result, "password"); probe->yellow = dbi_result_get_float(result, "yellow"); probe->red = dbi_result_get_float(result, "red"); if (probe->msg) g_free(probe->msg); probe->msg = NULL; probe->seen = 1; } if (dbi_conn_error_flag(conn)) { const char *errmsg; dbi_conn_error(conn, &errmsg); LOG(LOG_ERR, "%s", errmsg); g_hash_table_foreach(cache, reset_seen, NULL); } else { g_hash_table_foreach_remove(cache, return_seen, NULL); } dbi_result_free(result); }
/* This does preprocessing including handling of "other lint" (non-dupes) * After rm_preprocess(), all remaining duplicate candidates are in * a jagged GSList of GSLists as follows: * session->tables->size_groups->group1->file1a * ->file1b * ->file1c * ->group2->file2a * ->file2b * etc */ void rm_preprocess(RmSession *session) { RmFileTables *tables = session->tables; GQueue *all_files = tables->all_files; session->total_filtered_files = session->total_files; /* initial sort by size */ g_queue_sort(all_files, (GCompareDataFunc)rm_file_cmp_full, session); rm_log_debug_line("initial size sort finished at time %.3f; sorted %d files", g_timer_elapsed(session->timer, NULL), session->total_files); /* split into file size groups; for each size, remove path doubles and bundle * hardlinks */ rm_assert_gentle(all_files->head); RmFile *file = g_queue_pop_head(all_files); RmFile *current_size_file = file; guint removed = 0; GHashTable *node_table = tables->node_table; while(file && !rm_session_was_aborted()) { /* group files into inode clusters */ GQueue *inode_cluster = rm_hash_table_setdefault(node_table, file, (RmNewFunc)g_queue_new); g_queue_push_tail(inode_cluster, file); /* get next file and check if it is part of the same group */ file = g_queue_pop_head(all_files); if(!file || rm_file_cmp_split(file, current_size_file, session) != 0) { /* process completed group (all same size & other criteria)*/ /* remove path doubles and handle "other" lint */ /* add an empty GSlist to our list of lists */ tables->size_groups = g_slist_prepend(tables->size_groups, NULL); removed += g_hash_table_foreach_remove( node_table, (GHRFunc)rm_pp_handle_inode_clusters, session); /* free up the node table for the next group */ g_hash_table_steal_all(node_table); if(tables->size_groups->data == NULL) { /* zero size group after handling other lint; remove it */ tables->size_groups = g_slist_delete_link(tables->size_groups, tables->size_groups); } } current_size_file = file; } session->other_lint_cnt += rm_pp_handler_other_lint(session); rm_log_debug_line( "path doubles removal/hardlink bundling/other lint finished at %.3f; removed %u " "of %d", g_timer_elapsed(session->timer, NULL), removed, session->total_files); rm_fmt_set_state(session->formats, RM_PROGRESS_STATE_PREPROCESS); }
static gboolean clean_users_hash(GHashTable *users) { int delay = purple_prefs_get_int(DELAY_PREF); time_t limit = time(NULL) - (60 * delay); g_hash_table_foreach_remove(users, (GHRFunc)check_expire_time, &limit); return TRUE; }
/** * \brief Destroy the buzhash data */ void hi_hash_destroy(hi_file *file) { if (file->buzhashes != NULL) { g_hash_table_foreach_remove(file->buzhashes,destroy_hash_value,NULL); g_hash_table_destroy(file->buzhashes); file->buzhashes = NULL; } }
static void destroy_k12_file_data(k12_t* fd) { g_hash_table_destroy(fd->src_by_id); g_hash_table_foreach_remove(fd->src_by_name,destroy_srcdsc,NULL); g_hash_table_destroy(fd->src_by_name); ws_buffer_free(&(fd->extra_info)); g_free(fd->seq_read_buff); g_free(fd->rand_read_buff); g_free(fd); }
static gboolean free_homemaps_by_key(gpointer key, gpointer spr, gpointer userdata) { sprite_where_t* p = (sprite_where_t *)spr; g_hash_table_foreach_remove(p->sprites, free_spriteinfo_by_key, 0); g_hash_table_destroy(p->sprites); KDEBUG_LOG(low32_val(p->mapid), "FREE HOME MAP [%u]", high32_val(p->mapid)); g_slice_free1(sizeof *p, p); return TRUE; }
/** * pixbuf_cache_reset: reset the pixbuf cache */ void gul_pixbuf_cache_reset (void) { if (gul_pixbufs_cache != NULL) { g_hash_table_foreach_remove (gul_pixbufs_cache, (GHRFunc) gul_pixbuf_free_cb, NULL); } }
static void prv_cancel_all_queues(dleyna_task_processor_t *processor) { DLEYNA_LOG_DEBUG("Enter"); g_hash_table_foreach_remove(processor->task_queues, prv_cancel_cb, NULL); DLEYNA_LOG_DEBUG("Exit"); }
static void external_unconfig(struct pluginDevice *sd) { if (sd->cmd_opts) { g_hash_table_foreach_remove(sd->cmd_opts, let_remove_eachitem, NULL); g_hash_table_destroy(sd->cmd_opts); sd->cmd_opts = NULL; } }
static void seahorse_object_model_dispose (GObject *gobject) { SeahorseObjectModel *self = SEAHORSE_OBJECT_MODEL (gobject); /* Release all our pointers and stuff */ g_hash_table_foreach_remove (self->rows, (GHRFunc)remove_each, self); G_OBJECT_CLASS (seahorse_object_model_parent_class)->dispose (gobject); }
void NameScope::Dispose () { if (names) { g_hash_table_foreach_remove (names, remove_handler, this); } EventObject::Dispose (); }
void msgcache_destroy(MsgCache *cache) { g_return_if_fail(cache != NULL); g_hash_table_foreach_remove(cache->msgnum_table, msgcache_msginfo_free_func, NULL); g_hash_table_destroy(cache->msgid_table); g_hash_table_destroy(cache->msgnum_table); g_free(cache); }
/** * free all entries of the pool * */ void network_connection_pool_free(network_connection_pool *pool) { if (!pool) return; g_hash_table_foreach_remove(pool->users, g_hash_table_true, NULL); g_hash_table_destroy(pool->users); g_free(pool); }
int collect_identical_files(){ init_iterator("FILE"); struct file_rec r; memset(&r, 0, sizeof(r)); GHashTable* hashset = g_hash_table_new_full(g_int_hash, hash_equal, NULL, free_file_list); while(iterate_file(&r) == 0){ if(r.fsize > 0){ struct file_list* fl = g_hash_table_lookup(hashset, r.hash); if(fl == NULL){ fl = malloc(sizeof(struct file_list)); fl->head = NULL; memcpy(fl->hash, r.hash, sizeof(r.hash)); g_hash_table_insert(hashset, fl->hash, fl); } struct file_item* item = malloc(sizeof(*item) + strlen(r.fname) + 1); item->fid = r.fid; item->fsize = r.fsize; strcpy(item->fname, r.fname); fl->head = g_list_prepend(fl->head, item); } } close_iterator(); g_hash_table_foreach_remove(hashset, only_one_item, NULL); GHashTableIter iter; gpointer key, value; g_hash_table_iter_init(&iter, hashset); char suffix[8]; while(g_hash_table_iter_next(&iter, &key, &value)){ struct file_list* fl = value; printf("HASH %d ", g_list_length(fl->head)); print_hash(fl->hash, 10); GList* elem = g_list_first(fl->head); do{ struct file_item* item = elem->data; parse_file_suffix(item->fname, suffix, sizeof(suffix)); if(strncmp(suffix, "edu,", 4) == 0){ strcpy(suffix, "edu,?"); }else if(strlen(suffix) == 0){ strcpy(suffix, ".None"); } printf("FILE %d %" PRId64 " %s %s\n", item->fid, item->fsize, item->fname, suffix); }while((elem = g_list_next(elem))); } g_hash_table_destroy(hashset); return 0; }
static void bt_remove(const char *prefix) { DBG("%s", prefix); if (bluetooth_hash == NULL) return; g_hash_table_foreach_remove(bluetooth_hash, bt_remove_device, (gpointer) prefix); }
static void unload (void) { // empty the class table. cairo_dock_reset_class_table (); // empty the applis table. g_hash_table_foreach_remove (s_hAppliIconsTable, (GHRFunc) _remove_appli, NULL); s_bAppliManagerIsRunning = FALSE; }
static void nlm_msg_res_match_init(void) { if(nlm_msg_res_unmatched != NULL){ g_hash_table_foreach_remove(nlm_msg_res_unmatched, nlm_msg_res_unmatched_free_all, NULL); } else { nlm_msg_res_unmatched=g_hash_table_new(nlm_msg_res_unmatched_hash, nlm_msg_res_unmatched_equal); } if(nlm_msg_res_matched != NULL){ g_hash_table_foreach_remove(nlm_msg_res_matched, nlm_msg_res_matched_free_all, NULL); } else { nlm_msg_res_matched=g_hash_table_new(nlm_msg_res_matched_hash, nlm_msg_res_matched_equal); } }
static gboolean cleanup_notify_group(gpointer key, gpointer value, gpointer user_data) { GHashTable *notify_list = value; g_hash_table_foreach_remove(notify_list, cleanup_notify, user_data); g_hash_table_destroy(notify_list); return TRUE; }
static void hfp_hf_remove(const char *prefix) { DBG("%s", prefix); if (modem_hash == NULL) return; g_hash_table_foreach_remove(modem_hash, hfp_remove_modem, (gpointer) prefix); }
/*! *\brief Set up list of parentmsgs * See procmsg_msg_has_flagged_parent_real() */ gboolean procmsg_msg_has_flagged_parent(MsgInfo *info, MsgPermFlags perm_flags) { gboolean result; GHashTable *parentmsgs = g_hash_table_new(NULL, NULL); result = procmsg_msg_has_flagged_parent_real(info, perm_flags, parentmsgs); g_hash_table_foreach_remove(parentmsgs, parentmsgs_hash_remove, NULL); g_hash_table_destroy(parentmsgs); return result; }
/** * walk through a single stringprep cache and check which entries have expired */ static void _jid_clean_single_cache(_jid_prep_cache_t cache, time_t keep_newer_as) { /* acquire the lock on the cache */ g_mutex_lock(cache->mutex); /* walk over all entries */ g_hash_table_foreach_remove(cache->hashtable, _jid_clean_walker, (void*)&keep_newer_as); /* we're done, release the lock on the cache */ g_mutex_unlock(cache->mutex); }