static void remove_connections_read (NMRemoteSettings *settings, gpointer user_data) { RemoveInfo *info = user_data; GSList *list, *iter; g_source_remove (info->timeout_id); g_message ("Removing Bluetooth connections for %s", info->str_bdaddr); list = nm_remote_settings_list_connections (settings); for (iter = list; iter != NULL; iter = g_slist_next (iter)) { NMConnection *connection = iter->data; NMSettingBluetooth *s_bt; const GByteArray *tmp; s_bt = nm_connection_get_setting_bluetooth (connection); if (s_bt) { tmp = nm_setting_bluetooth_get_bdaddr (s_bt); if (tmp && memcmp (tmp->data, info->bdaddr->data, tmp->len) == 0) nm_remote_connection_delete (NM_REMOTE_CONNECTION (connection), delete_cb, NULL); } } g_slist_free (list); remove_cleanup (info); }
bool hashtable2_remove(hashtable2* table, const void* key) { ASSERT(table != NULL); const unsigned raw_hash = table->hash_func(key); const unsigned hash = (raw_hash == 0) ? ~(unsigned)0 : raw_hash; const unsigned truncated_hash = hash % table->size; unsigned index = truncated_hash; do { hash_node *node = &table->table[index]; if (!node->hash) { /* Not occupied. */ return NULL; } if (node->hash == hash && table->cmp_func(key, node->key) == 0) { if (table->del_func) table->del_func(node->key, node->datum); node->hash = 0; table->count--; remove_cleanup(table, truncated_hash, (index + 1) % table->size); return true; } if (++index == table->size) { index = 0; } } while (index != truncated_hash); return false; }
extern void rcmd_set_inserted(struct render_command * cmd) { (cmd)->inserted = TRUE; /* remove cleanup */ remove_cleanup(&cmd->cleanup); }
static gboolean remove_timeout (gpointer user_data) { RemoveInfo *info = user_data; g_message ("Timed out removing Bluetooth connections for %s", info->str_bdaddr); remove_cleanup (info); return FALSE; }
void rcmd_remove(struct render_command * rcmd, rcmd_remove_reason_t reason, int flags) { /* NOTICE: remove_cleanup will detect whether * the cleanup is active. */ remove_cleanup(&rcmd->cleanup); if ((rcmd->ops) && (rcmd->ops->remove)) rcmd->ops->remove(rcmd, reason, flags); }
static void do_read_file_cleanup(struct cleanup * base) { struct read_file_cleanup * pcleanup; remove_cleanup(base); pcleanup = container_of(base, struct read_file_cleanup, base); struct png_reader * reader = &pcleanup->reader; cleanup_reader(reader); if (reader->io_ptr != NULL) { FILE * fp = reader->io_ptr; fclose(fp); reader->io_ptr = NULL; } GC_TRIVAL_FREE(pcleanup); }
static void do_write_file_cleanup(struct cleanup * base) { struct write_file_cleanup * pcleanup; remove_cleanup(base); pcleanup = container_of(base, struct write_file_cleanup, base); struct png_writer * writer = &pcleanup->writer; cleanup_writer(writer); if (writer->io_ptr != NULL) { FILE * fp = writer->io_ptr; fflush(fp); fclose(fp); writer->io_ptr = NULL; } GC_TRIVAL_FREE(pcleanup); }