Exemple #1
0
static void
_cogl_clip_stack_restore_real (CoglClipState *clip_state)
{
  CoglHandle stack;

  g_return_if_fail (clip_state->stacks != NULL);

  stack = clip_state->stacks->data;

  _cogl_clip_stack_unref (stack);

  /* Revert to an old stack */
  clip_state->stacks = g_slist_delete_link (clip_state->stacks,
                                            clip_state->stacks);
}
Exemple #2
0
/**
 * nice_component_detach_socket:
 * @component: a #NiceComponent
 * @socket: the socket to detach the source for
 *
 * Detach the #GSource for the single specified @socket. It also closes it
 * and frees it!
 *
 * If the @socket doesn’t exist in this @component, do nothing.
 */
static void
nice_component_detach_socket (NiceComponent *component, NiceSocket *nicesock)
{
  GSList *l;
  SocketSource *socket_source;

  nice_debug ("Detach socket %p.", nicesock);

  /* Remove the socket from various lists. */
  for (l = component->incoming_checks; l != NULL;) {
    IncomingCheck *icheck = l->data;
    GSList *next = l->next;

    if (icheck->local_socket == nicesock) {
      component->incoming_checks =
          g_slist_delete_link (component->incoming_checks, l);
      incoming_check_free (icheck);
    }

    l = next;
  }

  /* Find the SocketSource for the socket. */
  l = g_slist_find_custom (component->socket_sources, nicesock,
          _find_socket_source);
  if (l == NULL)
    return;

  /* Detach the source. */
  socket_source = l->data;
  component->socket_sources = g_slist_delete_link (component->socket_sources, l);
  component->socket_sources_age++;

  socket_source_detach (socket_source);
  socket_source_free (socket_source);
}
/**
 * nm_setting_ip4_config_remove_route:
 * @setting: the #NMSettingIP4Config
 * @i: index number of the route
 *
 * Removes the route at index @i.
 **/
void
nm_setting_ip4_config_remove_route (NMSettingIP4Config *setting, guint32 i)
{
	NMSettingIP4ConfigPrivate *priv;
	GSList *elt;

	g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));

	priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting);
	elt = g_slist_nth (priv->routes, i);
	g_return_if_fail (elt != NULL);

	nm_ip4_route_unref ((NMIP4Route *) elt->data);
	priv->routes = g_slist_delete_link (priv->routes, elt);
}
void
nm_setting_ip6_config_remove_dns_search (NMSettingIP6Config *setting, guint32 i)
{
	NMSettingIP6ConfigPrivate *priv;
	GSList *elt;

	g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));

	priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
	elt = g_slist_nth (priv->dns_search, i);
	g_return_if_fail (elt != NULL);

	g_free (elt->data);
	priv->dns_search = g_slist_delete_link (priv->dns_search, elt);
}
Exemple #5
0
void xmpp_del_feature(const char *xmlns)
{
  GSList *feature = xmpp_additional_features;
  while (feature) {
    if (!strcmp(feature->data, xmlns)) {
      ver = NULL;
      ver_notavail = NULL;
      g_free(feature->data);
      xmpp_additional_features = g_slist_delete_link(xmpp_additional_features,
                                                     feature);
      return;
    }
    feature = g_slist_next(feature);
  }
}
void
nm_auth_changed_func_unregister (GDestroyNotify callback, gpointer callback_data)
{
	GSList *iter;

	for (iter = funcs; iter; iter = g_slist_next (iter)) {
		PkChangedInfo *info = iter->data;

		if ((callback == info->changed_callback) && (callback_data == info->changed_data)) {
			g_free (info);
			funcs = g_slist_delete_link (funcs, iter);
			break;
		}
	}
}
/**
 * nm_setting_connection_remove_secondary:
 * @setting: the #NMSettingConnection
 * @idx: index number of the secondary connection UUID
 *
 * Removes the secondary coonnection UUID at index @idx.
 **/
void
nm_setting_connection_remove_secondary (NMSettingConnection *setting, guint32 idx)
{
	NMSettingConnectionPrivate *priv;
	GSList *elt;

	g_return_if_fail (NM_IS_SETTING_CONNECTION (setting));

	priv = NM_SETTING_CONNECTION_GET_PRIVATE (setting);
	elt = g_slist_nth (priv->secondaries, idx);
	g_return_if_fail (elt != NULL);

	g_free (elt->data);
	priv->secondaries = g_slist_delete_link (priv->secondaries, elt);
}
/**
 * nm_setting_ip6_config_remove_address:
 * @setting: the #NMSettingIP6Config
 * @i: index number of the address to remove
 *
 * Removes the address at index @i.
 **/
void
nm_setting_ip6_config_remove_address (NMSettingIP6Config *setting, guint32 i)
{
	NMSettingIP6ConfigPrivate *priv;
	GSList *elt;

	g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));

	priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting);
	elt = g_slist_nth (priv->addresses, i);
	g_return_if_fail (elt != NULL);

	nm_ip6_address_unref ((NMIP6Address *) elt->data);
	priv->addresses = g_slist_delete_link (priv->addresses, elt);
}
Exemple #9
0
static inline void* queued_dsmesock_(unsigned type, const char* name)
{
  queued_msg_t* container = 0;
  dsmemsg_generic_t* msg = 0;

  assert(dsmesock_broadcasts);

  container = dsmesock_broadcasts->data;
  msg = container->data;
  assert(msg->type_ == type);

  free(container);
  dsmesock_broadcasts = g_slist_delete_link(dsmesock_broadcasts, dsmesock_broadcasts);
  return msg;
}
Exemple #10
0
/**
 * nm_setting_wired_remove_mac_blacklist_item:
 * @setting: the #NMSettingWired
 * @idx: index number of the MAC address
 *
 * Removes the MAC address at index @idx from the blacklist.
 *
 * Since: 0.9.10
 **/
void
nm_setting_wired_remove_mac_blacklist_item (NMSettingWired *setting, guint32 idx)
{
	NMSettingWiredPrivate *priv;
	GSList *elt;

	g_return_if_fail (NM_IS_SETTING_WIRED (setting));

	priv = NM_SETTING_WIRED_GET_PRIVATE (setting);
	elt = g_slist_nth (priv->mac_address_blacklist, idx);
	g_return_if_fail (elt != NULL);

	g_free (elt->data);
	priv->mac_address_blacklist = g_slist_delete_link (priv->mac_address_blacklist, elt);
}
Exemple #11
0
void
_cogl_xlib_remove_filter (CoglXlibFilterFunc func,
                          gpointer data)
{
  GSList *l, *prev = NULL;

  _COGL_GET_CONTEXT (ctx, NO_RETVAL);

  for (l = ctx->winsys.event_filters; l; prev = l, l = l->next)
    {
      CoglXlibFilterClosure *closure = l->data;

      if (closure->func == func && closure->data == data)
        {
          g_slice_free (CoglXlibFilterClosure, closure);
          if (prev)
            prev->next = g_slist_delete_link (prev->next, l);
          else
            ctx->winsys.event_filters =
              g_slist_delete_link (ctx->winsys.event_filters, l);
          break;
        }
    }
}
static void
gst_multi_file_sink_ensure_max_files (GstMultiFileSink * multifilesink)
{
  char *filename;

  while (multifilesink->max_files &&
      multifilesink->n_files >= multifilesink->max_files) {
    filename = multifilesink->files->data;
    g_remove (filename);
    g_free (filename);
    multifilesink->files = g_slist_delete_link (multifilesink->files,
        multifilesink->files);
    multifilesink->n_files -= 1;
  }
}
Exemple #13
0
static void
bonjour_bytestreams_listen(int sock, gpointer data)
{
	PurpleXfer *xfer = data;
	XepXfer *xf;
	XepIq *iq;
	xmlnode *query, *streamhost;
	gchar *port;
	GSList *local_ips;
	BonjourData *bd;

	purple_debug_info("bonjour", "Bonjour-bytestreams-listen. sock=%d.\n", sock);
	if (sock < 0 || xfer == NULL) {
		/*purple_xfer_cancel_local(xfer);*/
		return;
	}

	xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ,
					 bonjour_sock5_request_cb, xfer);
	xf = (XepXfer*)xfer->data;
	xf->listen_data = NULL;

	bd = xf->data;

	iq = xep_iq_new(bd, XEP_IQ_SET, xfer->who, bonjour_get_jid(bd->jabber_data->account), xf->sid);

	query = xmlnode_new_child(iq->node, "query");
	xmlnode_set_namespace(query, "http://jabber.org/protocol/bytestreams");
	xmlnode_set_attrib(query, "sid", xf->sid);
	xmlnode_set_attrib(query, "mode", "tcp");

	xfer->local_port = purple_network_get_port_from_fd(sock);

	local_ips = bonjour_jabber_get_local_ips(sock);

	port = g_strdup_printf("%hu", (guint16)purple_xfer_get_local_port(xfer));
	while(local_ips) {
		streamhost = xmlnode_new_child(query, "streamhost");
		xmlnode_set_attrib(streamhost, "jid", xf->sid);
		xmlnode_set_attrib(streamhost, "host", local_ips->data);
		xmlnode_set_attrib(streamhost, "port", port);
		g_free(local_ips->data);
		local_ips = g_slist_delete_link(local_ips, local_ips);
	}
	g_free(port);

	xep_iq_send_and_free(iq);
}
Exemple #14
0
/**
 * na_core_utils_slist_remove_utf8:
 * @slist: the #GSList to be updated.
 * @text: the string to be removed.
 *
 * Removes from the @slist the item which has a string which is equal to
 * @text.
 *
 * Returns: the new @slist start position.
 *
 * Since: 2.30
 */
GSList *
na_core_utils_slist_remove_utf8( GSList *slist, const gchar *text )
{
	GSList *is;

	for( is = slist ; is ; is = is->next ){
		const gchar *istr = ( const gchar * ) is->data;
		if( !na_core_utils_str_collate( text, istr )){
			g_free( is->data );
			slist = g_slist_delete_link( slist, is );
			break;
		}
	}

	return( slist );
}
/**
 * nm_setting_connection_remove_permission:
 * @setting: the #NMSettingConnection
 * @idx: the zero-based index of the permission to remove
 *
 * Removes the permission at index @idx from the connection.
 */
void
nm_setting_connection_remove_permission (NMSettingConnection *setting,
                                         guint32 idx)
{
	NMSettingConnectionPrivate *priv;
	GSList *iter;

	g_return_if_fail (NM_IS_SETTING_CONNECTION (setting));

	priv = NM_SETTING_CONNECTION_GET_PRIVATE (setting);
	iter = g_slist_nth (priv->permissions, idx);
	g_return_if_fail (iter != NULL);

	permission_free ((Permission *) iter->data);
	priv->permissions = g_slist_delete_link (priv->permissions, iter);
}
Exemple #16
0
void free_new_node(struct new_node_event_t *node_event) {
    GSList *cursor;

    cursor = node_event->resources;
    while (cursor != NULL) {
	struct resource_info_t *resource = (struct resource_info_t*)cursor->data;
        if (resource->has_value)
            free((char*)resource->value);
	free(resource);

        resource = NULL;
        cursor = g_slist_delete_link(cursor, cursor);
    }

    free(node_event);
}
Exemple #17
0
void refresh_prune_socket (NiceAgent *agent, NiceSocket *sock)
{
  GSList *i;

  for (i = agent->refresh_list; i;) {
    GSList *next = i->next;
    CandidateRefresh *refresh = i->data;

    if (refresh->nicesock == sock) {
      agent->refresh_list = g_slist_delete_link (agent->refresh_list, i);
      refresh_free_item (refresh);
    }

    i = next;
  }
}
Exemple #18
0
void refresh_prune_candidate (NiceAgent *agent, NiceCandidate *candidate)
{
  GSList *i;

  for (i = agent->refresh_list; i;) {
    GSList *next = i->next;
    CandidateRefresh *refresh = i->data;

    if (refresh->candidate == candidate) {
      agent->refresh_list = g_slist_delete_link (agent->refresh_list, i);
      refresh_free_item (refresh);
    }

    i = next;
  }
}
Exemple #19
0
gboolean
rcd_identity_remove_backend (RCDIdentityBackend *backend)
{
    GSList *link;

    g_return_val_if_fail (backend != NULL, FALSE);

    link = g_slist_find (identity_backends, backend);

    if (!link)
        return FALSE;

    identity_backends = g_slist_delete_link (identity_backends, link);

    return TRUE;
}
/**
 * nm_setting_wireless_remove_mac_blacklist_item:
 * @setting: the #NMSettingWireless
 * @idx: index number of the MAC address
 *
 * Removes the MAC address at index @idx from the blacklist.
 *
 * Since: 0.9.10
 **/
void
nm_setting_wireless_remove_mac_blacklist_item (NMSettingWireless *setting, guint32 idx)
{
	NMSettingWirelessPrivate *priv;
	GSList *elt;

	g_return_if_fail (NM_IS_SETTING_WIRELESS (setting));

	priv = NM_SETTING_WIRELESS_GET_PRIVATE (setting);
	elt = g_slist_nth (priv->mac_address_blacklist, idx);
	g_return_if_fail (elt != NULL);

	g_free (elt->data);
	priv->mac_address_blacklist = g_slist_delete_link (priv->mac_address_blacklist, elt);
	g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST);
}
Exemple #21
0
static void
sync_proxies_use_underline (gpointer action,
                            gboolean use_underline)
{
    GSList *proxies;

    proxies = g_slist_copy (gtk_action_get_proxies (GTK_ACTION (action)));
    g_slist_foreach (proxies, (GFunc) g_object_ref, NULL);

    while (proxies)
    {
        proxy_set_use_underline (GTK_WIDGET (proxies->data), use_underline);
        g_object_unref (proxies->data);
        proxies = g_slist_delete_link (proxies, proxies);
    }
}
static GstFlowReturn
gst_wayland_sink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
    GstCaps * caps, GstBuffer ** buf)
{
  GstWaylandSink *sink = GST_WAYLAND_SINK (bsink);
  GstWlBuffer *buffer = NULL;
  GstFlowReturn ret = GST_FLOW_OK;
  GstStructure *structure = NULL;
  GstCaps *desired_caps = NULL;

  GST_LOG_OBJECT (sink, "a buffer of %u bytes was requested with caps "
      "%" GST_PTR_FORMAT " and offset %" G_GUINT64_FORMAT, size, caps, offset);

  desired_caps = gst_caps_copy (caps);
  structure = gst_caps_get_structure (desired_caps, 0);

  if (gst_structure_get_int (structure, "width", &sink->video_width) &&
      gst_structure_get_int (structure, "height", &sink->video_height)) {
    sink->bpp = size / sink->video_width / sink->video_height;
  }

  g_mutex_lock (sink->pool_lock);
  while (sink->buffer_pool) {
    buffer = (GstWlBuffer *) sink->buffer_pool->data;

    if (buffer) {
      sink->buffer_pool =
          g_slist_delete_link (sink->buffer_pool, sink->buffer_pool);
    } else {
      break;
    }
  }

  g_mutex_unlock (sink->pool_lock);

  if (!buffer)
    buffer = wayland_buffer_create (sink);

  if (buffer)
    gst_buffer_set_caps (GST_BUFFER (buffer), caps);

  *buf = GST_BUFFER (buffer);

  gst_caps_unref (desired_caps);

  return ret;
}
static void
set_default_candidate_encodings (GtkSourceFileLoader *loader)
{
	GSList *list;
	GSList *l;
	const GtkSourceEncoding *file_encoding;

	/* Get first the default candidates from GtkSourceEncoding. If the
	 * GtkSourceFile's encoding has been set by a FileLoader or FileSaver,
	 * put it at the beginning of the list.
	 */
	list = gtk_source_encoding_get_default_candidates ();

	if (loader->priv->file == NULL)
	{
		goto end;
	}

	file_encoding = gtk_source_file_get_encoding (loader->priv->file);

	if (file_encoding == NULL)
	{
		goto end;
	}

	/* Remove file_encoding from the list, if already present, and prepend
	 * it to the list.
	 */
	for (l = list; l != NULL; l = l->next)
	{
		const GtkSourceEncoding *cur_encoding = l->data;

		if (cur_encoding == file_encoding)
		{
			list = g_slist_delete_link (list, l);

			/* The list doesn't contain duplicates, normally. */
			break;
		}
	}

	list = g_slist_prepend (list, (gpointer) file_encoding);

end:
	g_slist_free (loader->priv->candidate_encodings);
	loader->priv->candidate_encodings = list;
}
Exemple #24
0
gboolean falcon_filter_unregister(gboolean is_dir, const gchar *pattern,
                                  falcon_filter_func func)
{
	GRegex *regex = NULL;
	GRegex *key = NULL;
	GSList *list = NULL;
	GSList *target = NULL;
	falcon_filter_t filter = {is_dir, func};

	if (!pattern) {
		g_warning(_("Failed to unregister filter with no pattern."));
		return FALSE;
	}

	regex = falcon_filter_regex_new(pattern);
	if (!regex)
		return FALSE;

	g_mutex_lock(lock);
	if (!registry) {
		g_critical(_("Filter registry uninitialized."
		             " Failed to unregister filter with pattern %s"), pattern);
		g_mutex_unlock(lock);
		return FALSE;
	}

	if (!g_hash_table_lookup_extended(registry, regex, (gpointer *)&key,
	                                  (gpointer *)&list)) {
		g_mutex_unlock(lock);
		return FALSE;
	}

	target = g_slist_find_custom(list, &filter, falcon_filter_compare);
	if (target) {
		g_free(target->data);
		list = g_slist_delete_link(list, target);
	}

	if (list == NULL)
		g_hash_table_remove(registry, key);
	else
		g_hash_table_insert(registry, key, list);

	g_regex_unref(regex);
	g_mutex_unlock(lock);
	return TRUE;
}
Exemple #25
0
/* remove highlight_link from the global highlight_list */
static void
highlight_remove (GSList *highlight_link)
{
        WarlockHighlight *highlight;
        GSList *cur;
        char *key;
        guint i, id;

        g_assert (highlight_link != NULL);
        highlight = highlight_link->data;
        g_assert (highlight != NULL);

        id = highlight->id;

        debug ("removing element: %X\n", id);

        /* remove the notifications on this highlight */
        for (cur = highlight->gconf_connections; cur != NULL;
                        cur = cur->next) {
                preferences_notify_remove (GPOINTER_TO_INT (cur->data));
        }

        /* remove the tags, and delete the highlight from the list */
        highlight_remove_tags (id);
        highlight_list = g_slist_delete_link (highlight_list, highlight_link);

        /* unset the gconf keys */
        preferences_unset (preferences_get_highlight_key
                        (id, PREF_HIGHLIGHT_STRING));

        for (i = 0; i < HIGHLIGHT_MATCHES; i++) {
                preferences_unset (preferences_get_highlight_match_key (id, i,
                                        PREF_HIGHLIGHT_MATCH_TEXT_COLOR));
                preferences_unset (preferences_get_highlight_match_key (id, i,
                                        PREF_HIGHLIGHT_MATCH_BASE_COLOR));
                preferences_unset (preferences_get_highlight_match_key (id, i,
                                        PREF_HIGHLIGHT_MATCH_FONT));
        }

        preferences_unset (preferences_get_highlight_key
                        (id, PREF_HIGHLIGHT_CASE_SENSITIVE));
        key = g_strdup_printf ("%s/%06X", preferences_get_key (PREF_HIGHLIGHTS),
                        id);
        preferences_unset (key);
        g_free (key);
}
static void
startMovingNextTorrent( struct relocate_dialog_data * data )
{
    char * str;
    const int id = GPOINTER_TO_INT( data->torrent_ids->data );

    tr_torrent * tor = gtr_core_find_torrent( data->core, id );
    if( tor != NULL )
        tr_torrentSetLocation( tor, previousLocation, data->do_move, NULL, &data->done );

    data->torrent_ids = g_slist_delete_link( data->torrent_ids,
                                             data->torrent_ids );

    str = g_strdup_printf( _( "Moving \"%s\"" ), tr_torrentName( tor ) );
    gtk_message_dialog_set_markup( GTK_MESSAGE_DIALOG( data->message_dialog ), str );
    g_free( str );
}
Exemple #27
0
static void jabber_x_data_cancel_cb(struct jabber_x_data_data *data, GaimRequestFields *fields) {
	xmlnode *result = xmlnode_new("x");
	jabber_x_data_cb cb = data->cb;
	gpointer user_data = data->user_data;
	JabberStream *js = data->js;
	g_hash_table_destroy(data->fields);
	while(data->values) {
		g_free(data->values->data);
		data->values = g_slist_delete_link(data->values, data->values);
	}
	g_free(data);

	xmlnode_set_namespace(result, "jabber:x:data");
	xmlnode_set_attrib(result, "type", "cancel");

	cb(js, result, user_data);
}
/**
 * g_static_private_set:
 * @private_key: a #GStaticPrivate
 * @data: the new pointer
 * @notify: a function to be called with the pointer whenever the
 *     current thread ends or sets this pointer again
 *
 * Sets the pointer keyed to @private_key for the current thread and
 * the function @notify to be called with that pointer (%NULL or
 * non-%NULL), whenever the pointer is set again or whenever the
 * current thread ends.
 *
 * This function works even if g_thread_init() has not yet been called.
 * If g_thread_init() is called later, the @data keyed to @private_key
 * will be inherited only by the main thread, i.e. the one that called
 * g_thread_init().
 *
 * @notify is used quite differently from @destructor in g_private_new().
 */
void
g_static_private_set (GStaticPrivate *private_key,
                      gpointer        data,
                      GDestroyNotify  notify)
{
  GArray *array;
  static guint next_index = 0;
  GStaticPrivateNode *node;

  if (!private_key->index)
    {
      G_LOCK (g_thread);

      if (!private_key->index)
        {
          if (g_thread_free_indices)
            {
              private_key->index = GPOINTER_TO_UINT (g_thread_free_indices->data);
              g_thread_free_indices = g_slist_delete_link (g_thread_free_indices,
                                                           g_thread_free_indices);
            }
          else
            private_key->index = ++next_index;
        }

      G_UNLOCK (g_thread);
    }

  array = g_private_get (&static_private_private);
  if (!array)
    {
      array = g_array_new (FALSE, TRUE, sizeof (GStaticPrivateNode));
      g_private_set (&static_private_private, array);
    }
  if (private_key->index > array->len)
    g_array_set_size (array, private_key->index);

  node = &g_array_index (array, GStaticPrivateNode, private_key->index - 1);

  if (node->destroy)
    node->destroy (node->data);

  node->data = data;
  node->destroy = notify;
  node->owner = private_key;
}
/**
 * nm_setting_vlan_remove_priority:
 * @map: the type of priority map
 * @setting: the #NMSettingVlan
 * @idx: the zero-based index of the priority map to remove
 *
 * Removes the priority map at index @idx from the
 * #NMSettingVlan:ingress_priority_map or #NMSettingVlan:egress_priority_map
 * properties.
 */
void
nm_setting_vlan_remove_priority (NMSettingVlan *setting,
                                 NMVlanPriorityMap map,
                                 guint32 idx)
{
	GSList *list = NULL, *item = NULL;

	g_return_if_fail (NM_IS_SETTING_VLAN (setting));
	g_return_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP);

	list = get_map (setting, map);
	g_return_if_fail (idx < g_slist_length (list));

	item = g_slist_nth_data (list, idx);
	priority_map_free ((PriorityMap *) item);
	set_map (setting, map, g_slist_delete_link (list, item));
}
Exemple #30
0
gboolean g_obex_remove_request_function(GObex *obex, guint id)
{
	struct req_handler *handler;
	GSList *match;

	match = g_slist_find_custom(obex->req_handlers, GUINT_TO_POINTER(id),
							req_handler_cmpid);
	if (match == NULL)
		return FALSE;

	handler = match->data;

	obex->req_handlers = g_slist_delete_link(obex->req_handlers, match);
	g_free(handler);

	return TRUE;
}