static void yahoo_update_alias_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) { xmlnode *node, *result; struct callback_data *cb = user_data; PurpleConnection *gc = cb->gc; YahooData *yd; yd = gc->proto_data; yd->url_datas = g_slist_remove(yd->url_datas, url_data); if (len == 0 || error_message != NULL) { purple_debug_info("yahoo", "Error updating alias for %s: %s\n", cb->who, error_message ? error_message : ""); g_free(cb->who); g_free(cb->id); g_free(cb); return; } result = xmlnode_from_str(url_text, -1); if (result == NULL) { purple_debug_error("yahoo", "Alias update for %s failed: Badly formed response\n", cb->who); g_free(cb->who); g_free(cb->id); g_free(cb); return; } if ((node = xmlnode_get_child(result, "ct"))) { if (cb->id == NULL) { const char *new_id = xmlnode_get_attrib(node, "id"); if (new_id != NULL) { /* We now have an addressbook id for the friend; we should save it */ YahooFriend *f = yahoo_friend_find(cb->gc, cb->who); purple_debug_info("yahoo", "Alias creation for %s succeeded\n", cb->who); if (f) yahoo_friend_set_alias_id(f, new_id); else purple_debug_error("yahoo", "Missing YahooFriend. Unable to store new addressbook id.\n"); } else purple_debug_error("yahoo", "Missing new addressbook id in add response for %s (weird).\n", cb->who); } else { if (g_ascii_strncasecmp(xmlnode_get_attrib(node, "id"), cb->id, strlen(cb->id))==0) purple_debug_info("yahoo", "Alias update for %s succeeded\n", cb->who); else purple_debug_error("yahoo", "Alias update for %s failed (Contact record return mismatch)\n", cb->who); } } else purple_debug_info("yahoo", "Alias update for %s failed (No contact record returned)\n", cb->who); g_free(cb->who); g_free(cb->id); g_free(cb); xmlnode_free(result); }
void jabber_auth_remove_mech(JabberSaslMech *mech) { auth_mechs = g_slist_remove(auth_mechs, mech); }
static void inf_test_mass_join_connect(InfTestMassJoin* massjoin, const char* hostname, guint port, const char* document, const char* username) { InfIpAddress* addr; InfTcpConnection* tcp; InfXmppConnection* xmpp; InfTestMassJoiner* joiner; InfXmlConnection* xml; GError* error; addr = inf_ip_address_new_from_string(hostname); tcp = inf_tcp_connection_new(massjoin->io, addr, port); xmpp = inf_xmpp_connection_new( tcp, INF_XMPP_CONNECTION_CLIENT, g_get_host_name(), hostname, INF_XMPP_CONNECTION_SECURITY_BOTH_PREFER_TLS, NULL, NULL, NULL ); joiner = g_slice_new(InfTestMassJoiner); joiner->communication_manager = inf_communication_manager_new(); joiner->browser = infc_browser_new( massjoin->io, joiner->communication_manager, INF_XML_CONNECTION(xmpp) ); joiner->session = NULL; joiner->document = g_strdup(document); joiner->username = g_strdup(username); g_object_unref(xmpp); g_object_unref(tcp); inf_ip_address_free(addr); massjoin->joiners = g_slist_prepend(massjoin->joiners, joiner); infc_browser_add_plugin(joiner->browser, &INF_TEST_MASS_JOIN_TEXT_PLUGIN); g_signal_connect( G_OBJECT(joiner->browser), "notify::status", G_CALLBACK(inf_test_mass_join_browser_notify_status_cb), massjoin ); error = NULL; xml = infc_browser_get_connection(joiner->browser); if(inf_xml_connection_open(xml, &error) == FALSE) { fprintf( stderr, "Joiner %s: Failed to connect to %s: %s\n", joiner->username, hostname, error->message ); g_error_free(error); massjoin->joiners = g_slist_remove(massjoin->joiners, joiner); if(massjoin->joiners == NULL) inf_standalone_io_loop_quit(INF_STANDALONE_IO(massjoin->io)); } }
void servlist_favchan_remove (ircnet *net, favchannel *channel) { servlist_favchan_free (channel); net->favchanlist = g_slist_remove (net->favchanlist, channel); }
/** * connman_notifier_unregister: * @notifier: notifier module * * Remove a previously registered notifier module */ void connman_notifier_unregister(struct connman_notifier *notifier) { DBG("notifier %p name %s", notifier, notifier->name); notifier_list = g_slist_remove(notifier_list, notifier); }
static void image_menu_destroy (GtkWidget *image, gpointer data) { image_menu_items = g_slist_remove (image_menu_items, image); }
/** * gtk_text_buffer_deserialize: * @register_buffer: the #GtkTextBuffer @format is registered with * @content_buffer: the #GtkTextBuffer to deserialize into * @format: the rich text format to use for deserializing * @iter: insertion point for the deserialized text * @data: (array length=length): data to deserialize * @length: length of @data * @error: return location for a #GError * * This function deserializes rich text in format @format and inserts * it at @iter. * * @format<!-- -->s to be used must be registered using * gtk_text_buffer_register_deserialize_format() or * gtk_text_buffer_register_deserialize_tagset() beforehand. * * Return value: %TRUE on success, %FALSE otherwise. * * Since: 2.10 **/ gboolean gtk_text_buffer_deserialize (GtkTextBuffer *register_buffer, GtkTextBuffer *content_buffer, GdkAtom format, GtkTextIter *iter, const guint8 *data, gsize length, GError **error) { GList *formats; GList *list; g_return_val_if_fail (GTK_IS_TEXT_BUFFER (register_buffer), FALSE); g_return_val_if_fail (GTK_IS_TEXT_BUFFER (content_buffer), FALSE); g_return_val_if_fail (format != GDK_NONE, FALSE); g_return_val_if_fail (iter != NULL, FALSE); g_return_val_if_fail (data != NULL, FALSE); g_return_val_if_fail (length > 0, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); formats = g_object_get_qdata (G_OBJECT (register_buffer), deserialize_quark ()); for (list = formats; list; list = g_list_next (list)) { GtkRichTextFormat *fmt = list->data; if (fmt->atom == format) { GtkTextBufferDeserializeFunc function = fmt->function; gboolean success; GSList *split_tags; GSList *list; GtkTextMark *left_end = NULL; GtkTextMark *right_start = NULL; GSList *left_start_list = NULL; GSList *right_end_list = NULL; /* We don't want the tags that are effective at the insertion * point to affect the pasted text, therefore we remove and * remember them, so they can be re-applied left and right of * the inserted text after pasting */ split_tags = gtk_text_iter_get_tags (iter); list = split_tags; while (list) { GtkTextTag *tag = list->data; list = g_slist_next (list); /* If a tag begins at the insertion point, ignore it * because it doesn't affect the pasted text */ if (gtk_text_iter_begins_tag (iter, tag)) split_tags = g_slist_remove (split_tags, tag); } if (split_tags) { /* Need to remember text marks, because text iters * don't survive pasting */ left_end = gtk_text_buffer_create_mark (content_buffer, NULL, iter, TRUE); right_start = gtk_text_buffer_create_mark (content_buffer, NULL, iter, FALSE); for (list = split_tags; list; list = g_slist_next (list)) { GtkTextTag *tag = list->data; GtkTextIter *backward_toggle = gtk_text_iter_copy (iter); GtkTextIter *forward_toggle = gtk_text_iter_copy (iter); GtkTextMark *left_start = NULL; GtkTextMark *right_end = NULL; gtk_text_iter_backward_to_tag_toggle (backward_toggle, tag); left_start = gtk_text_buffer_create_mark (content_buffer, NULL, backward_toggle, FALSE); gtk_text_iter_forward_to_tag_toggle (forward_toggle, tag); right_end = gtk_text_buffer_create_mark (content_buffer, NULL, forward_toggle, TRUE); left_start_list = g_slist_prepend (left_start_list, left_start); right_end_list = g_slist_prepend (right_end_list, right_end); gtk_text_buffer_remove_tag (content_buffer, tag, backward_toggle, forward_toggle); gtk_text_iter_free (forward_toggle); gtk_text_iter_free (backward_toggle); } left_start_list = g_slist_reverse (left_start_list); right_end_list = g_slist_reverse (right_end_list); } success = function (register_buffer, content_buffer, iter, data, length, fmt->can_create_tags, fmt->user_data, error); if (!success && error != NULL && *error == NULL) g_set_error (error, 0, 0, _("Unknown error when trying to deserialize %s"), gdk_atom_name (format)); if (split_tags) { GSList *left_list; GSList *right_list; GtkTextIter left_e; GtkTextIter right_s; /* Turn the remembered marks back into iters so they * can by used to re-apply the remembered tags */ gtk_text_buffer_get_iter_at_mark (content_buffer, &left_e, left_end); gtk_text_buffer_get_iter_at_mark (content_buffer, &right_s, right_start); for (list = split_tags, left_list = left_start_list, right_list = right_end_list; list && left_list && right_list; list = g_slist_next (list), left_list = g_slist_next (left_list), right_list = g_slist_next (right_list)) { GtkTextTag *tag = list->data; GtkTextMark *left_start = left_list->data; GtkTextMark *right_end = right_list->data; GtkTextIter left_s; GtkTextIter right_e; gtk_text_buffer_get_iter_at_mark (content_buffer, &left_s, left_start); gtk_text_buffer_get_iter_at_mark (content_buffer, &right_e, right_end); gtk_text_buffer_apply_tag (content_buffer, tag, &left_s, &left_e); gtk_text_buffer_apply_tag (content_buffer, tag, &right_s, &right_e); gtk_text_buffer_delete_mark (content_buffer, left_start); gtk_text_buffer_delete_mark (content_buffer, right_end); } gtk_text_buffer_delete_mark (content_buffer, left_end); gtk_text_buffer_delete_mark (content_buffer, right_start); g_slist_free (split_tags); g_slist_free (left_start_list); g_slist_free (right_end_list); } return success; } } g_set_error (error, 0, 0, _("No deserialize function found for format %s"), gdk_atom_name (format)); return FALSE; }
void check_notification(MateConfListeners* listeners) { guint ids[128]; guint i; const gchar** keyp; guint id_retloc; gchar* key_retloc; memset(ids, 0, sizeof(ids[0]) * 128); i = 0; keyp = keys; while (i < 128 && *keyp) { struct stuff* s; s = g_new0(struct stuff, 1); s->id_retloc = &id_retloc; s->key_retloc = &key_retloc; s->id = ids[i] = mateconf_listeners_add(listeners, *keyp, s, test_destroy_notify); s->key = g_strdup(*keyp); check(ids[i] != 0, "invalid connection ID returned for added listener"); /* printf("%u added at `%s'\n", s->id, s->key); */ ++i; ++keyp; } check(mateconf_listeners_count(listeners) == i, "number of listeners added (%u) don't now exist in the MateConfListeners (%u exist)", i, mateconf_listeners_count(listeners)); keyp = keys; while (*keyp) { GSList* tmp = NULL; const gchar** sub_keyp; struct notify_data nd = { NULL, NULL }; nd.notify_key = *keyp; mateconf_listeners_notify(listeners, *keyp, notify_callback, &nd); /* Check that the list that was notified matches the list that should have been */ sub_keyp = keys; while (*sub_keyp) { struct stuff* s = NULL; gboolean should_be = should_be_notified(*keyp, *sub_keyp); tmp = nd.notified; while (tmp != NULL) { s = tmp->data; if (strcmp(s->key, *sub_keyp) == 0) break; tmp = g_slist_next(tmp); } if (should_be) { check (tmp != NULL, "listener at `%s' should have been notified of change to `%s' and was not", *sub_keyp, *keyp); s = tmp->data; /* remove so we can handle duplicate keys */ nd.notified = g_slist_remove(nd.notified, tmp->data); #if 0 g_assert(strcmp(s->key, *sub_keyp) == 0); printf("%u at `%s' notified properly of `%s'\n", s->id, *sub_keyp, *keyp); #endif } else { check(tmp == NULL, "listener at `%s' should not have been notified of change to `%s' but it was", *sub_keyp, *keyp); #if 0 printf("`%s' properly not notified of `%s'\n", *sub_keyp, *keyp); #endif } ++sub_keyp; } if (nd.notified != NULL) { GSList* tmp = nd.notified; while (tmp != NULL) { struct stuff* s = tmp->data; fprintf(stderr, "leftover: %u at `%s' notified of `%s'\n", s->id, s->key, *keyp); tmp = g_slist_next(tmp); } } check (nd.notified == NULL, "superfluous listeners were notified of `%s'; perhaps listeners were notified twice?", *keyp); ++keyp; } i = 0; keyp = keys; while (i < 128 && *keyp) { id_retloc = 0; key_retloc = NULL; mateconf_listeners_remove(listeners, ids[i]); check(strcmp(key_retloc, *keyp) == 0, "listener removed has different key from listener added (`%s' vs. `%s')", *keyp, key_retloc); g_free(key_retloc); check(ids[i] == id_retloc, "listener removed had different id from that added (%u vs. %u)", ids[i], id_retloc); ++i; ++keyp; } check(mateconf_listeners_count(listeners) == 0, "listener count isn't 0 after removing all the listeners"); }
static void mate_panel_applet_destroy (GtkWidget *widget, AppletInfo *info) { GList *l; g_return_if_fail (info != NULL); info->widget = NULL; if (info->settings) { g_object_unref (info->settings); info->settings = NULL; } registered_applets = g_slist_remove (registered_applets, info); queued_position_saves = g_slist_remove (queued_position_saves, info); if (info->type == PANEL_OBJECT_DRAWER) { Drawer *drawer = info->data; if (drawer->toplevel) { PanelWidget *panel_widget; panel_widget = panel_toplevel_get_panel_widget ( drawer->toplevel); panel_widget->master_widget = NULL; gtk_widget_destroy (GTK_WIDGET (drawer->toplevel)); drawer->toplevel = NULL; } } if (info->type != PANEL_OBJECT_APPLET) panel_lockdown_notify_remove (G_CALLBACK (mate_panel_applet_recreate_menu), info); if (info->menu) g_object_unref (info->menu); info->menu = NULL; if (info->data_destroy) info->data_destroy (info->data); info->data = NULL; for (l = info->user_menu; l != NULL; l = l->next) { AppletUserMenu *umenu = l->data; g_free (umenu->name); g_free (umenu->stock_item); g_free (umenu->text); g_free (umenu); } g_list_free (info->user_menu); info->user_menu = NULL; g_free (info->id); info->id = NULL; g_free (info); }
/** * fab_host_delete - * @fab_ctx: fab context pointer * @dpid : switch dpid to the connected host * @sw_alias : switch alias id to the connected host * @fl : flow defining a host * @locked : flag to specify whether fab_ctx is already held or not * @deactivate : flag to specify whether to only deactivate not delete * * Delete a fabric host */ int fab_host_delete(fab_struct_t *fab_ctx, struct flow *fl, bool locked, bool deactivate, bool sync_ha) { fab_host_t *lkup_host, *host; char *host_pstr; int err = 0; bool dont_free = false; fab_port_t *port; fab_switch_t *sw; lkup_host = fab_host_create(0, 0, fl); if (!locked) c_wr_lock(&fab_ctx->lock); if (!(host = g_hash_table_lookup(fab_ctx->host_htbl, lkup_host))) { if (!deactivate) { err = fab_host_delete_inactive(fab_ctx, lkup_host, true); } else { c_log_err("%s: No active host", FN); err = -1; } goto done; } host->dead = true; __fab_host_route_delete(host, NULL, fab_ctx); __fab_del_pending_routes_tofro_host(fab_ctx, host); if (host->tenant_nw) { host->tenant_nw->host_list = g_slist_remove(host->tenant_nw->host_list, host); fab_tenant_nw_put(host->tenant_nw); host->tenant_nw = NULL; } if (deactivate) { fab_host_clone_prop(lkup_host, host); host_pstr = fab_dump_single_host(lkup_host); c_log_err("%s: Host Active->Inactive %s", FN, host_pstr); free(host_pstr); fab_host_add_inactive(fab_ctx, lkup_host, true); dont_free = true; } else { /* Force port off the host and hence its host ref */ if ((sw = __fab_switch_get(fab_ctx, host->sw.swid))) { c_rd_lock(&sw->lock); if ((port = __fab_port_find(fab_ctx, sw, host->sw.port)) && port->host == host) { fab_host_put(port->host); port->host = NULL; } fab_switch_put_locked(sw); c_rd_unlock(&sw->lock); } host_pstr = fab_dump_single_host(lkup_host); c_log_err("%s: Host Deleted %s", FN, host_pstr); free(host_pstr); } g_hash_table_remove(fab_ctx->host_htbl, host); done: if (!locked) c_wr_unlock(&fab_ctx->lock); if (!dont_free) fab_free(lkup_host); return err; }
void cr_repomd_detach_record(cr_Repomd *repomd, cr_RepomdRecord *rec) { if (!repomd || !rec); repomd->records = g_slist_remove(repomd->records, rec); }
/* insert_chunk function will recalculate the free_chunk_list, the data_size, the end_of_file, and the data_gathered as appropriate. It will also insert the data chunk that is coming in the right place of the file in memory. HINTS: file->data_gathered contains the real data gathered independently from the file length file->file_length contains the length of the file in memory, i.e., the last offset captured. In most cases, the real file length would be different. */ static void insert_chunk(active_file *file, export_object_entry_t *entry, const smb_eo_t *eo_info) { guint nfreechunks = g_slist_length(file->free_chunk_list); guint i; free_chunk *current_free_chunk; free_chunk *new_free_chunk; guint64 chunk_offset=eo_info->smb_file_offset; guint64 chunk_length=eo_info->payload_len; guint64 chunk_end_offset = chunk_offset+chunk_length-1; /* Size of file in memory */ guint64 calculated_size = chunk_offset+chunk_length; gpointer dest_memory_addr; /* Let's recalculate the file length and data gathered */ if (file->data_gathered==0 && nfreechunks==0) { /* If this is the first entry for this file, we first create an initial free chunk */ new_free_chunk=g_malloc(sizeof(free_chunk)); new_free_chunk->start_offset=0; new_free_chunk->end_offset=MAX(file->file_length,chunk_end_offset+1)-1; file->free_chunk_list=NULL; file->free_chunk_list=g_slist_append(file->free_chunk_list,new_free_chunk); nfreechunks+=1; } else { if (chunk_end_offset > file->file_length-1) { new_free_chunk=g_malloc(sizeof(free_chunk)); new_free_chunk->start_offset=file->file_length; new_free_chunk->end_offset=chunk_end_offset; file->free_chunk_list=g_slist_append(file->free_chunk_list,new_free_chunk); nfreechunks+=1; } } file->file_length = MAX(file->file_length,chunk_end_offset+1); for (i=0;i<nfreechunks;i++) { current_free_chunk = g_slist_nth_data(file->free_chunk_list,i); if (chunk_offset <= current_free_chunk->start_offset ) { if (chunk_end_offset >= current_free_chunk->start_offset) { if (chunk_end_offset < current_free_chunk->end_offset) { file->data_gathered+= (chunk_end_offset-current_free_chunk->start_offset+1); current_free_chunk->start_offset=chunk_end_offset+1; } else { file->data_gathered+= (current_free_chunk->end_offset-current_free_chunk->start_offset+1); file->free_chunk_list = g_slist_remove(file->free_chunk_list,current_free_chunk); nfreechunks-=1; if (nfreechunks==0) { /* The free chunk list is empty */ g_slist_free(file->free_chunk_list); file->free_chunk_list=NULL; break; } } } else { break; } } else { if (chunk_offset <= current_free_chunk->end_offset) { if (chunk_end_offset < current_free_chunk->end_offset) { new_free_chunk=g_malloc(sizeof(free_chunk)); new_free_chunk->start_offset=chunk_end_offset+1; new_free_chunk->end_offset=current_free_chunk->end_offset; current_free_chunk->end_offset=chunk_offset-1; file->free_chunk_list = g_slist_insert(file->free_chunk_list,new_free_chunk,i+1); file->data_gathered+=chunk_length; } else { file->data_gathered+=current_free_chunk->end_offset-chunk_offset+1; current_free_chunk->end_offset=chunk_offset-1; } } } } /* Now, let's insert the data chunk into memory ...first, we shall be able to allocate the memory */ if (!entry->payload_data) { /* This is a New file */ if (calculated_size > G_MAXSIZE) { /* * The argument to g_try_malloc() is * a gsize, the maximum value of which is * G_MAXSIZE. If the calculated size is * bigger than that, we just say the attempt * to allocate memory failed. */ entry->payload_data=NULL; } else { entry->payload_data = g_try_malloc((gsize)calculated_size); entry->payload_len=calculated_size; } if (!entry->payload_data) { /* Memory error */ file->is_out_of_memory=TRUE; } } else { /* This is an existing file in memory */ if (calculated_size > (guint64) entry->payload_len && !file->is_out_of_memory) { /* We need more memory */ if (calculated_size > G_MAXSIZE) { /* * As for g_try_malloc(), so for * g_try_realloc(). */ dest_memory_addr=NULL; } else { dest_memory_addr=g_try_realloc( entry->payload_data, (gsize)calculated_size); } if(!dest_memory_addr) { /* Memory error */ file->is_out_of_memory=TRUE; /* We don't have memory for this file. Free the current file content from memory */ g_free(entry->payload_data); entry->payload_data=NULL; entry->payload_len=0; } else { entry->payload_data=dest_memory_addr; entry->payload_len=calculated_size; } } } /* ...then, put the chunk of the file in the right place */ if(!file->is_out_of_memory) { dest_memory_addr=entry->payload_data+chunk_offset; g_memmove(dest_memory_addr,eo_info->payload_data,eo_info->payload_len); } }
static void one_plugin_destroyed (gpointer data, GObject *object) { active_plugins = g_slist_remove (active_plugins, object); }
static void yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) { PurpleConnection *gc = user_data; YahooData *yd = gc->proto_data; yd->url_datas = g_slist_remove(yd->url_datas, url_data); if (len == 0) { purple_debug_info("yahoo", "No Aliases to process.%s%s\n", error_message ? " Error:" : "", error_message ? error_message : ""); } else { gchar *full_name, *nick_name; const char *yid, *id, *fn, *ln, *nn, *alias, *mn; const char *hp, *wp, *mo; YahooFriend *f; PurpleBuddy *b; xmlnode *item, *contacts; PurpleAccount *account; account = purple_connection_get_account(gc); /* Put our web response into a xmlnode for easy management */ contacts = xmlnode_from_str(url_text, -1); if (contacts == NULL) { purple_debug_error("yahoo", "Badly formed Alias XML\n"); return; } purple_debug_info("yahoo", "Fetched %" G_GSIZE_FORMAT " bytes of alias data\n", len); /* Loop around and around and around until we have gone through all the received aliases */ for(item = xmlnode_get_child(contacts, "ct"); item; item = xmlnode_get_next_twin(item)) { /* Yahoo replies with two types of contact (ct) record, we are only interested in the alias ones */ if ((yid = xmlnode_get_attrib(item, "yi"))) { YahooPersonalDetails *ypd = NULL; /* Grab all the bits of information we can */ fn = xmlnode_get_attrib(item, "fn"); ln = xmlnode_get_attrib(item, "ln"); nn = xmlnode_get_attrib(item, "nn"); mn = xmlnode_get_attrib(item, "mn"); id = xmlnode_get_attrib(item, "id"); hp = xmlnode_get_attrib(item, "hp"); wp = xmlnode_get_attrib(item, "wp"); mo = xmlnode_get_attrib(item, "mo"); full_name = nick_name = NULL; alias = NULL; /* Yahoo stores first and last names separately, lets put them together into a full name */ if (yd->jp) full_name = g_strstrip(g_strdup_printf("%s %s", (ln != NULL ? ln : "") , (fn != NULL ? fn : ""))); else full_name = g_strstrip(g_strdup_printf("%s %s", (fn != NULL ? fn : "") , (ln != NULL ? ln : ""))); nick_name = (nn != NULL ? g_strstrip(g_strdup(nn)) : NULL); if (nick_name != NULL) alias = nick_name; /* If we have a nickname from Yahoo, let's use it */ else if (strlen(full_name) != 0) alias = full_name; /* If no Yahoo nickname, we can use the full_name created above */ /* Find the local buddy that matches */ f = yahoo_friend_find(gc, yid); b = purple_find_buddy(account, yid); /* If we don't find a matching buddy, ignore the alias !! */ if (f != NULL && b != NULL) { const char *buddy_alias = purple_buddy_get_alias(b); yahoo_friend_set_alias_id(f, id); /* Finally, if we received an alias, we better update the buddy list */ if (alias != NULL) { serv_got_alias(gc, yid, alias); purple_debug_info("yahoo", "Fetched alias '%s' (%s)\n", alias, id); } else if (buddy_alias != NULL && strcmp(buddy_alias, "") != 0) { /* Or if we have an alias that Yahoo doesn't, send it up */ yahoo_update_alias(gc, yid, buddy_alias); purple_debug_info("yahoo", "Sent updated alias '%s'\n", buddy_alias); } } if (f != NULL) ypd = &f->ypd; else { /* May be the alias is for the account? */ const char *yidn = purple_normalize(account, yid); if (purple_strequal(yidn, purple_connection_get_display_name(gc))) { ypd = &yd->ypd; } } if (ypd) { yahoo_personal_details_reset(ypd, TRUE); ypd->id = g_strdup(id); ypd->names.first = g_strdup(fn); ypd->names.middle = g_strdup(mn); ypd->names.last = g_strdup(ln); ypd->names.nick = g_strdup(nn); ypd->phone.work = g_strdup(wp); ypd->phone.home = g_strdup(hp); ypd->phone.mobile = g_strdup(mo); } g_free(full_name); g_free(nick_name); } } xmlnode_free(contacts); } }
/** * vpn_rtnl_unregister: * @rtnl: RTNL module * * Remove a previously registered RTNL module */ void vpn_rtnl_unregister(struct vpn_rtnl *rtnl) { DBG("rtnl %p name %s", rtnl, rtnl->name); rtnl_list = g_slist_remove(rtnl_list, rtnl); }
drakvuf_trap_t* pluginex::detach_plugin_params(drakvuf_trap_t* data) { m_params = g_slist_remove(m_params, data); return data; }
static void set_new_cond_list(struct ofono_call_forwarding *cf, int type, GSList *list) { GSList *old = cf->cf_conditions[type]; DBusConnection *conn = ofono_dbus_get_connection(); const char *path = __ofono_atom_get_path(cf->atom); GSList *l; GSList *o; struct ofono_call_forwarding_condition *lc; struct ofono_call_forwarding_condition *oc; const char *number; dbus_uint16_t timeout; char attr[64]; char tattr[64]; gboolean update_sim = FALSE; gboolean old_cfu; gboolean new_cfu; if ((cf->flags & CALL_FORWARDING_FLAG_CPHS_CFF) || cf->cfis_record_id > 0) old_cfu = is_cfu_enabled(cf, NULL); else old_cfu = FALSE; for (l = list; l; l = l->next) { lc = l->data; /* * New condition lists might have attributes we don't care about * triggered by e.g. ss control magic strings just skip them * here. For now we only support Voice, although Fax & all Data * basic services are applicable as well. */ if (lc->cls > BEARER_CLASS_VOICE) continue; timeout = lc->time; number = phone_number_to_string(&lc->phone_number); snprintf(attr, sizeof(attr), "%s%s", bearer_class_to_string(lc->cls), cf_type_lut[type]); if (type == CALL_FORWARDING_TYPE_NO_REPLY) snprintf(tattr, sizeof(tattr), "%sTimeout", attr); o = g_slist_find_custom(old, GINT_TO_POINTER(lc->cls), cf_condition_find_with_cls); if (o) { /* On the old list, must be active */ oc = o->data; if (oc->phone_number.type != lc->phone_number.type || strcmp(oc->phone_number.number, lc->phone_number.number)) { ofono_dbus_signal_property_changed(conn, path, OFONO_CALL_FORWARDING_INTERFACE, attr, DBUS_TYPE_STRING, &number); if (type == CALL_FORWARDING_TYPE_UNCONDITIONAL) update_sim = TRUE; } if (type == CALL_FORWARDING_TYPE_NO_REPLY && oc->time != lc->time) ofono_dbus_signal_property_changed(conn, path, OFONO_CALL_FORWARDING_INTERFACE, tattr, DBUS_TYPE_UINT16, &timeout); /* Remove from the old list */ g_free(o->data); old = g_slist_remove(old, o->data); } else { number = phone_number_to_string(&lc->phone_number); ofono_dbus_signal_property_changed(conn, path, OFONO_CALL_FORWARDING_INTERFACE, attr, DBUS_TYPE_STRING, &number); if (type == CALL_FORWARDING_TYPE_UNCONDITIONAL) update_sim = TRUE; if (type == CALL_FORWARDING_TYPE_NO_REPLY && lc->time != DEFAULT_NO_REPLY_TIMEOUT) ofono_dbus_signal_property_changed(conn, path, OFONO_CALL_FORWARDING_INTERFACE, tattr, DBUS_TYPE_UINT16, &timeout); } } timeout = DEFAULT_NO_REPLY_TIMEOUT; number = ""; for (o = old; o; o = o->next) { oc = o->data; /* * For now we only support Voice, although Fax & all Data * basic services are applicable as well. */ if (oc->cls > BEARER_CLASS_VOICE) continue; snprintf(attr, sizeof(attr), "%s%s", bearer_class_to_string(oc->cls), cf_type_lut[type]); if (type == CALL_FORWARDING_TYPE_NO_REPLY) snprintf(tattr, sizeof(tattr), "%sTimeout", attr); ofono_dbus_signal_property_changed(conn, path, OFONO_CALL_FORWARDING_INTERFACE, attr, DBUS_TYPE_STRING, &number); if (type == CALL_FORWARDING_TYPE_UNCONDITIONAL) update_sim = TRUE; if (type == CALL_FORWARDING_TYPE_NO_REPLY && oc->time != DEFAULT_NO_REPLY_TIMEOUT) ofono_dbus_signal_property_changed(conn, path, OFONO_CALL_FORWARDING_INTERFACE, tattr, DBUS_TYPE_UINT16, &timeout); } cf_list_clear(old); cf->cf_conditions[type] = list; if (update_sim == TRUE) sim_set_cf_indicator(cf); if ((cf->flags & CALL_FORWARDING_FLAG_CPHS_CFF) || cf->cfis_record_id > 0) new_cfu = is_cfu_enabled(cf, NULL); else new_cfu = FALSE; if (new_cfu != old_cfu) { ofono_bool_t status = new_cfu; ofono_dbus_signal_property_changed(conn, path, OFONO_CALL_FORWARDING_INTERFACE, "ForwardingFlagOnSim", DBUS_TYPE_BOOLEAN, &status); } }
void pluginex::destroy_trap(drakvuf_t drakvuf, drakvuf_trap_t* trap) { m_params = g_slist_remove(m_params, trap); drakvuf_remove_trap(drakvuf, trap, destroy_plugin_params); }
static gboolean client_cb(GIOChannel *chan, GIOCondition cond, gpointer data) { char buf[BT_SUGGESTED_BUFFER_SIZE]; bt_audio_msg_header_t *msghdr = (void *) buf; struct unix_client *client = data; int len; const char *type, *name; if (cond & G_IO_NVAL) return FALSE; if (cond & (G_IO_HUP | G_IO_ERR)) { DBG("Unix client disconnected (fd=%d)", client->sock); goto failed; } memset(buf, 0, sizeof(buf)); len = recv(client->sock, buf, sizeof(buf), 0); if (len < 0) { error("recv: %s (%d)", strerror(errno), errno); goto failed; } type = bt_audio_strtype(msghdr->type); name = bt_audio_strname(msghdr->name); DBG("Audio API: %s <- %s", type, name); if (msghdr->length != len) { error("Invalid message: length mismatch"); goto failed; } switch (msghdr->name) { case BT_GET_CAPABILITIES: handle_getcapabilities_req(client, (struct bt_get_capabilities_req *) msghdr); break; case BT_OPEN: handle_open_req(client, (struct bt_open_req *) msghdr); break; case BT_SET_CONFIGURATION: handle_setconfiguration_req(client, (struct bt_set_configuration_req *) msghdr); break; case BT_START_STREAM: handle_streamstart_req(client, (struct bt_start_stream_req *) msghdr); break; case BT_STOP_STREAM: handle_streamstop_req(client, (struct bt_stop_stream_req *) msghdr); break; case BT_CLOSE: handle_close_req(client, (struct bt_close_req *) msghdr); break; case BT_CONTROL: handle_control_req(client, (struct bt_control_req *) msghdr); break; case BT_DELAY_REPORT: handle_delay_report_req(client, (struct bt_delay_report_req *) msghdr); break; default: error("Audio API: received unexpected message name %d", msghdr->name); } return TRUE; failed: clients = g_slist_remove(clients, client); start_close(client->dev, client, FALSE); client_free(client); return FALSE; }
static void knockout_destroy(IRC_SERVER_REC *server, KNOCKOUT_REC *rec) { server->knockoutlist = g_slist_remove(server->knockoutlist, rec); g_free(rec->ban); g_free(rec); }
void servlist_command_remove (ircnet *net, commandentry *entry) { servlist_command_free (entry); net->commandlist = g_slist_remove (net->commandlist, entry); }
void ofono_audio_settings_driver_unregister(const struct ofono_audio_settings_driver *d) { DBG("driver: %p, name: %s", d, d->name); g_drivers = g_slist_remove(g_drivers, (void *) d); }
void migrate_del_blocker(Error *reason) { migration_blockers = g_slist_remove(migration_blockers, reason); }
gboolean mono_domain_finalize (MonoDomain *domain, guint32 timeout) { DomainFinalizationReq *req; MonoInternalThread *thread = mono_thread_internal_current (); gint res; gboolean ret; gint64 start; #if defined(__native_client__) return FALSE; #endif if (mono_thread_internal_current () == gc_thread) /* We are called from inside a finalizer, not much we can do here */ return FALSE; /* * No need to create another thread 'cause the finalizer thread * is still working and will take care of running the finalizers */ if (gc_disabled) return TRUE; /* We don't support domain finalization without a GC */ if (mono_gc_is_null ()) return FALSE; mono_gc_collect (mono_gc_max_generation ()); req = g_new0 (DomainFinalizationReq, 1); req->ref = 2; req->domain = domain; mono_coop_sem_init (&req->done, 0); if (domain == mono_get_root_domain ()) finalizing_root_domain = TRUE; mono_finalizer_lock (); domains_to_finalize = g_slist_append (domains_to_finalize, req); mono_finalizer_unlock (); /* Tell the finalizer thread to finalize this appdomain */ mono_gc_finalize_notify (); if (timeout == -1) timeout = INFINITE; if (timeout != INFINITE) start = mono_msec_ticks (); ret = TRUE; for (;;) { if (timeout == INFINITE) { res = mono_coop_sem_wait (&req->done, MONO_SEM_FLAGS_ALERTABLE); } else { gint64 elapsed = mono_msec_ticks () - start; if (elapsed >= timeout) { ret = FALSE; break; } res = mono_coop_sem_timedwait (&req->done, timeout - elapsed, MONO_SEM_FLAGS_ALERTABLE); } if (res == MONO_SEM_TIMEDWAIT_RET_SUCCESS) { break; } else if (res == MONO_SEM_TIMEDWAIT_RET_ALERTED) { if ((thread->state & (ThreadState_StopRequested | ThreadState_SuspendRequested)) != 0) { ret = FALSE; break; } } else if (res == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT) { ret = FALSE; break; } else { g_error ("%s: unknown result %d", __func__, res); } } if (!ret) { /* Try removing the req from domains_to_finalize: * - if it's not found: the domain is being finalized, * so we the ref count is already decremented * - if it's found: the domain is not yet being finalized, * so we can safely decrement the ref */ gboolean found; mono_finalizer_lock (); found = g_slist_index (domains_to_finalize, req) != -1; if (found) domains_to_finalize = g_slist_remove (domains_to_finalize, req); mono_finalizer_unlock (); if (found) { /* We have to decrement it wherever we * remove it from domains_to_finalize */ if (InterlockedDecrement (&req->ref) != 1) g_error ("%s: req->ref should be 1, as we are the first one to decrement it", __func__); } goto done; } if (domain == mono_get_root_domain ()) { mono_threadpool_ms_cleanup (); mono_gc_finalize_threadpool_threads (); } done: if (InterlockedDecrement (&req->ref) == 0) { mono_coop_sem_destroy (&req->done); g_free (req); } return ret; }
static void resolve_cb (AvahiServiceResolver * service_resolver, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const gchar * service_name, const gchar * type, const gchar * domain, const gchar * host_name, const AvahiAddress * address, uint16_t port, AvahiStringList * text, #ifdef HAVE_AVAHI_0_6 AvahiLookupResultFlags flags, #endif DMAPMdnsBrowser * browser) { gchar *name = NULL; gchar *pair = NULL; /* FIXME: extract DACP-specific items into sub-class? See also howl code. */ gchar host[AVAHI_ADDRESS_STR_MAX]; gboolean pp = FALSE; DMAPMdnsBrowserService *service; switch (event) { case AVAHI_RESOLVER_FAILURE: g_warning ("Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", service_name, type, domain, avahi_strerror (avahi_client_errno (avahi_service_resolver_get_client (service_resolver)))); break; case AVAHI_RESOLVER_FOUND: if (text) { AvahiStringList *l; for (l = text; l != NULL; l = l->next) { size_t size; gchar *key; gchar *value; gint ret; ret = avahi_string_list_get_pair (l, &key, &value, &size); if (ret != 0 || key == NULL) { continue; } if (strcmp (key, "Password") == 0) { if (size >= 4 && strncmp (value, "true", 4) == 0) { pp = TRUE; } else if (size >= 1 && strncmp (value, "1", 1) == 0) { pp = TRUE; } } else if (strcmp (key, "Machine Name") == 0) { if (name == NULL) name = g_strdup (value); } else if (strcmp (key, "DvNm") == 0) { if (name != NULL) g_free (name); /* Remote's name is presented as DvNm in DACP */ name = g_strdup (value); } else if (strcmp (key, "Pair") == 0) { /* Pair is used when first connecting to a DACP remote */ pair = g_strdup (value); } g_free (key); g_free (value); } } if (name == NULL) { name = g_strdup (service_name); } avahi_address_snprint (host, AVAHI_ADDRESS_STR_MAX, address); service = g_new (DMAPMdnsBrowserService, 1); service->service_name = g_strdup (service_name); service->name = name; service->host = g_strdup (host); service->port = port; service->pair = pair; service->password_protected = pp; browser->priv->services = g_slist_append (browser->priv->services, service); g_signal_emit (browser, dmap_mdns_browser_signals[SERVICE_ADDED], 0, service); break; default: g_warning ("Unhandled event"); break; } browser->priv->resolvers = g_slist_remove (browser->priv->resolvers, service_resolver); avahi_service_resolver_free (service_resolver); }
static gpointer g_thread_pool_thread_proxy (gpointer data) { GRealThreadPool *pool; pool = data; DEBUG_MSG (("thread %p started for pool %p.", g_thread_self (), pool)); g_async_queue_lock (pool->queue); while (TRUE) { gpointer task; task = g_thread_pool_wait_for_new_task (pool); if (task) { if (pool->running || !pool->immediate) { /* A task was received and the thread pool is active, * so execute the function. */ g_async_queue_unlock (pool->queue); DEBUG_MSG (("thread %p in pool %p calling func.", g_thread_self (), pool)); pool->pool.func (task, pool->pool.user_data); g_async_queue_lock (pool->queue); } } else { /* No task was received, so this thread goes to the global pool. */ gboolean free_pool = FALSE; DEBUG_MSG (("thread %p leaving pool %p for global pool.", g_thread_self (), pool)); pool->num_threads--; if (!pool->running) { if (!pool->waiting) { if (pool->num_threads == 0) { /* If the pool is not running and no other * thread is waiting for this thread pool to * finish and this is the last thread of this * pool, free the pool. */ free_pool = TRUE; } else { /* If the pool is not running and no other * thread is waiting for this thread pool to * finish and this is not the last thread of * this pool and there are no tasks left in the * queue, wakeup the remaining threads. */ if (g_async_queue_length_unlocked (pool->queue) == - pool->num_threads) g_thread_pool_wakeup_and_stop_all (pool); } } else if (pool->immediate || g_async_queue_length_unlocked (pool->queue) <= 0) { /* If the pool is not running and another thread is * waiting for this thread pool to finish and there * are either no tasks left or the pool shall stop * immediately, inform the waiting thread of a change * of the thread pool state. */ g_cond_broadcast (&pool->cond); } } g_async_queue_unlock (pool->queue); if (free_pool) g_thread_pool_free_internal (pool); if ((pool = g_thread_pool_wait_for_new_pool ()) == NULL) break; g_async_queue_lock (pool->queue); DEBUG_MSG (("thread %p entering pool %p from global pool.", g_thread_self (), pool)); /* pool->num_threads++ is not done here, but in * g_thread_pool_start_thread to make the new started * thread known to the pool before itself can do it. */ } } { GThread * self; self = g_thread_self (); G_LOCK (threads); active_threads = g_slist_remove (active_threads, self); finished_threads = g_slist_prepend (finished_threads, self); G_UNLOCK (threads); } return NULL; }
static void text_chunk_destroy(TEXT_BUFFER_REC *buffer, TEXT_CHUNK_REC *chunk) { buffer->text_chunks = g_slist_remove(buffer->text_chunks, chunk); g_slice_free(TEXT_CHUNK_REC, chunk); }
static void skypeweb_close(PurpleConnection *pc) { SkypeWebAccount *sa; GSList *buddies; g_return_if_fail(pc != NULL); sa = purple_connection_get_protocol_data(pc); g_return_if_fail(sa != NULL); purple_timeout_remove(sa->authcheck_timeout); purple_timeout_remove(sa->poll_timeout); purple_timeout_remove(sa->watchdog_timeout); skypeweb_logout(sa); purple_signal_disconnect(purple_conversations_get_handle(), "conversation-updated", pc, PURPLE_CALLBACK(skypeweb_mark_conv_seen)); purple_debug_info("skypeweb", "destroying %d waiting connections\n", g_queue_get_length(sa->waiting_conns)); while (!g_queue_is_empty(sa->waiting_conns)) skypeweb_connection_destroy(g_queue_pop_tail(sa->waiting_conns)); g_queue_free(sa->waiting_conns); purple_debug_info("skypeweb", "destroying %d incomplete connections\n", g_slist_length(sa->conns)); while (sa->conns != NULL) skypeweb_connection_destroy(sa->conns->data); while (sa->dns_queries != NULL) { PurpleDnsQueryData *dns_query = sa->dns_queries->data; purple_debug_info("skypeweb", "canceling dns query for %s\n", purple_dnsquery_get_host(dns_query)); sa->dns_queries = g_slist_remove(sa->dns_queries, dns_query); purple_dnsquery_destroy(dns_query); } while (sa->url_datas) { purple_util_fetch_url_cancel(sa->url_datas->data); sa->url_datas = g_slist_delete_link(sa->url_datas, sa->url_datas); } buddies = purple_find_buddies(sa->account, NULL); while (buddies != NULL) { PurpleBuddy *buddy = buddies->data; skypeweb_buddy_free(buddy); purple_buddy_set_protocol_data(buddy, NULL); buddies = g_slist_delete_link(buddies, buddies); } g_hash_table_destroy(sa->sent_messages_hash); g_hash_table_destroy(sa->cookie_table); g_hash_table_destroy(sa->hostname_ip_cache); g_free(sa->messages_host); g_free(sa->skype_token); g_free(sa->registration_token); g_free(sa->endpoint); g_free(sa->username); g_free(sa); }
void network_remove_client(Client *client) { network->clients = g_slist_remove(network->clients, client); }
/** * Unregister an I/O monitor * Note: This does NOT shutdown I/O channels created from file descriptors * * @param io_monitor A pointer to the I/O monitor to unregister */ void mce_unregister_io_monitor(gconstpointer io_monitor) { iomon_struct *iomon = (iomon_struct *)io_monitor; guint oldlen; if (iomon == NULL) { mce_log(LL_DEBUG, "iomon == NULL!"); goto EXIT; } oldlen = g_slist_length(file_monitors); if (file_monitors != NULL) file_monitors = g_slist_remove(file_monitors, iomon); /* Did we remove any entry? */ if (oldlen == g_slist_length(file_monitors)) { mce_log(LL_WARN, "Trying to unregister non-existing file monitor"); } /* Remove I/O watches */ mce_suspend_io_monitor(iomon); /* We can close this I/O channel, since it's not an external fd */ if (iomon->fd == -1) { GIOStatus iostatus; GError *error = NULL; iostatus = g_io_channel_shutdown(iomon->iochan, TRUE, &error); if (iostatus != G_IO_STATUS_NORMAL) { loglevel_t loglevel = LL_ERR; /* If we get ENODEV, only log a debug message, * since this happens for hotpluggable * /dev/input files */ if ((error->code == G_IO_CHANNEL_ERROR_FAILED) && (errno == ENODEV)) loglevel = LL_DEBUG; mce_log(loglevel, "Cannot close `%s'; %s", iomon->file, error->message); } /* Reset errno, * to avoid false positives down the line */ errno = 0; g_clear_error(&error); } g_io_channel_unref(iomon->iochan); g_free(iomon->file); g_slice_free(iomon_struct, iomon); EXIT: return; }