Пример #1
0
void
lt_grandfathered_set_preferred_tag(lt_grandfathered_t *grandfathered,
				   const gchar        *subtag)
{
	g_return_if_fail (grandfathered != NULL);
	g_return_if_fail (subtag != NULL);

	if (grandfathered->preferred_tag)
		lt_mem_remove_ref(&grandfathered->parent, grandfathered->preferred_tag);
	grandfathered->preferred_tag = g_strdup(subtag);
	lt_mem_add_ref(&grandfathered->parent, grandfathered->preferred_tag,
		       (lt_destroy_func_t)g_free);
}
Пример #2
0
void
lt_grandfathered_set_name(lt_grandfathered_t *grandfathered,
			  const gchar        *description)
{
	g_return_if_fail (grandfathered != NULL);
	g_return_if_fail (description != NULL);

	if (grandfathered->description)
		lt_mem_remove_ref(&grandfathered->parent, grandfathered->description);
	grandfathered->description = g_strdup(description);
	lt_mem_add_ref(&grandfathered->parent, grandfathered->description,
		       (lt_destroy_func_t)g_free);
}
Пример #3
0
void
lt_redundant_set_preferred_tag(lt_redundant_t *redundant,
			       const gchar    *subtag)
{
	g_return_if_fail (redundant != NULL);
	g_return_if_fail (subtag != NULL);

	if (redundant->preferred_tag)
		lt_mem_remove_ref(&redundant->parent, redundant->preferred_tag);
	redundant->preferred_tag = g_strdup(subtag);
	lt_mem_add_ref(&redundant->parent, redundant->preferred_tag,
		       (lt_destroy_func_t)g_free);
}
Пример #4
0
void
lt_redundant_set_name(lt_redundant_t *redundant,
		      const gchar    *description)
{
	g_return_if_fail (redundant != NULL);
	g_return_if_fail (description != NULL);

	if (redundant->description)
		lt_mem_remove_ref(&redundant->parent, redundant->description);
	redundant->description = g_strdup(description);
	lt_mem_add_ref(&redundant->parent, redundant->description,
		       (lt_destroy_func_t)g_free);
}
Пример #5
0
/**
 * lt_list_pop:
 * @list: a #lt_list_t
 * @data: a pointer to set the data in the first element
 *
 * Sets the data in the first element to @data and drop the element.
 *
 * Returns: the new head of @list.
 */
lt_list_t *
lt_list_pop(lt_list_t    *list,
	    lt_pointer_t *data)
{
	lt_return_val_if_fail (list != NULL, NULL);

	if (list->value)
		lt_mem_remove_ref(&list->parent, list->value);
	if (data)
		*data = list->value;
	list = lt_list_delete_link(list, list);

	return list;
}
Пример #6
0
/**
 * lt_list_remove:
 * @list: a #lt_list_t.
 * @data: the data of the element to remove.
 *
 * Removes an element from a #lt_list_t.
 * If two elements contain the same data, only the first is removed.
 * If none of the elements contain the data, the #lt_list_t is unchanged.
 * This works similar to lt_list_delete() though, the difference is
 * this won't calls the finalizer to destroy the data in the element.
 *
 * Returns: the new start of the #lt_list_t.
 */
lt_list_t *
lt_list_remove(lt_list_t    *list,
	       lt_pointer_t  data)
{
	lt_list_t *l = list;

	while (l) {
		if (l->value == data) {
			lt_mem_remove_ref(&l->parent, value);
			list = lt_list_delete_link(list, l);
			break;
		} else {
			l = l->next;
		}
	}

	return list;
}