Ejemplo n.º 1
0
/**
 * Collect entropy from constant pointers.
 */
static void
entropy_collect_pointers(SHA1Context *ctx)
{
	void *ptr[6];

	ptr[0] = ctx;
	ptr[1] = cast_func_to_pointer(&entropy_collect);
	ptr[2] = cast_func_to_pointer(&entropy_collect_pointers);
	ptr[3] = cast_func_to_pointer(&exit);	/* libc */
	ptr[4] = &errno;
	ptr[5] = &ptr;

	entropy_array_pointer_collect(ctx, ptr, G_N_ELEMENTS(ptr));
}
Ejemplo n.º 2
0
/**
 * Free whole tree, discarding each node with the supplied free routine.
 *
 * @param tree		the tree descriptor
 * @param fcb		free routine for each item
 */
void
etree_free(etree_t *tree, free_fn_t fcb)
{
	etree_foreach(tree, etree_item_free, cast_func_to_pointer(fcb));
	tree->root = NULL;
	tree->count = 0;
}
Ejemplo n.º 3
0
void
on_button_uploads_kill_clicked(GtkButton *unused_button, gpointer unused_udata)
{
    GtkTreeView *treeview;
    GtkTreeSelection *selection;

	(void) unused_button;
	(void) unused_udata;

    treeview = GTK_TREE_VIEW(gui_main_window_lookup("treeview_uploads"));
    selection = gtk_tree_view_get_selection(treeview);
    gtk_tree_selection_selected_foreach(selection, uploads_func_helper,
		cast_func_to_pointer(kill_upload));
}
Ejemplo n.º 4
0
/**
 * Initiates a browse host request to the currently selected host.
 */
void
on_popup_uploads_browse_host_activate(GtkMenuItem *unused_menuitem,
	gpointer unused_udata)
{
    GtkTreeView *treeview;
    GtkTreeSelection *selection;

	(void) unused_menuitem;
	(void) unused_udata;

    treeview = GTK_TREE_VIEW(gui_main_window_lookup("treeview_uploads"));
    selection = gtk_tree_view_get_selection(treeview);
    gtk_tree_selection_selected_foreach(selection, uploads_func_helper,
		cast_func_to_pointer(browse_uploading_host));
}
Ejemplo n.º 5
0
/**
 * Dispose of all the items remaining in the list, applying the supplied
 * free callback on all the items, then freeing the hash_list_t container
 * and nullifying its pointer.
 */
void
hash_list_free_all(hash_list_t **hl_ptr, free_fn_t freecb)
{
	g_assert(hl_ptr != NULL);
	g_assert(freecb != NULL);

	if (*hl_ptr != NULL) {
		hash_list_t *hl = *hl_ptr;

		hash_list_check(hl);
		elist_foreach(&hl->list, hash_list_freecb_wrapper,
			cast_func_to_pointer(freecb));
		hash_list_free(hl_ptr);
	}
}
Ejemplo n.º 6
0
/**
 * Dispose of all the items remaining in the list, applying the supplied
 * free callback on all the items, then freeing the list_t container
 * and nullifying its pointer.
 */
void
list_free_all(list_t **list_ptr, list_destroy_cb freecb)
{
	g_assert(list_ptr != NULL);
	g_assert(freecb != NULL);

	if (*list_ptr != NULL) {
		list_t *list = *list_ptr;

		list_check(list);
		G_LIST_FOREACH_WITH_DATA(list->head, list_freecb_wrapper,
			cast_func_to_pointer(freecb));
		list_free(list_ptr);
	}
}
Ejemplo n.º 7
0
/**
 * Dispose of all the items remaining in the list, applying the supplied free
 * callback on all the items, then freeing the slist_t container.
 */
void
slist_free_all(slist_t **slist_ptr, slist_destroy_cb freecb)
{
	g_assert(slist_ptr);
	g_assert(freecb);

	if (*slist_ptr) {
		slist_t *slist = *slist_ptr;

		slist_check(slist);
		G_SLIST_FOREACH_WITH_DATA(slist->head, slist_freecb_wrapper,
			cast_func_to_pointer(freecb));
		slist_free(slist_ptr);
	}
}