From b25fa8589635010a74304dbca9678a3ca5cdfd7d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 9 Apr 2016 23:14:09 +0000 Subject: small API change: do no longer pass rarely needed GNUNET_SCHEDULER_TaskContext to all scheduler tasks; instead, allow the relatively few tasks that need it to obtain the context via GNUNET_SCHEDULER_get_task_context() --- src/fs/Makefile.am | 3 +-- src/fs/gnunet-fs-gtk.c | 8 ++------ src/fs/gnunet-fs-gtk_main-window-search.c | 8 ++------ src/fs/gnunet-fs-gtk_publish-dialog.c | 4 +--- src/identity/gnunet-identity-gtk.c | 6 ++---- src/lib/animations.c | 4 +--- src/lib/eventloop.c | 9 ++++----- src/lib/glade.c | 4 ++-- src/lib/os_installation.c | 2 +- src/main/gnunet-gtk.c | 12 +++--------- src/namestore/Makefile.am | 4 +--- src/namestore/gnunet-namestore-gtk.c | 8 ++------ src/peerinfo/gnunet-peerinfo-gtk-flags.c | 2 +- src/peerinfo/gnunet-peerinfo-gtk.c | 2 +- src/setup/gnunet-setup-transport.c | 4 +--- src/setup/gnunet-setup.c | 11 +++-------- src/setup/gnunet-setup.h | 4 +--- 17 files changed, 29 insertions(+), 66 deletions(-) (limited to 'src') diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index f3e49a74..b011d7ca 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am @@ -45,11 +45,10 @@ gnunet_fs_gtk_LDADD = \ gnunet_fs_gtk_LDFLAGS = \ -export-dynamic -pkgcfgdir= $(prefix)/share/gnunet-gtk/config.d/ +pkgcfgdir= $(prefix)/share/gnunet/config.d/ pkgcfg_DATA = \ gnunet-fs-gtk.conf EXTRA_DIST = metatypes.c \ $(pkgcfg_DATA) - diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c index 054fc7bc..58db7609 100644 --- a/src/fs/gnunet-fs-gtk.c +++ b/src/fs/gnunet-fs-gtk.c @@ -233,11 +233,9 @@ GNUNET_GTK_main_window_configure_event_cb (GtkWidget *main_window, * Task run on shutdown. * * @param cls NULL - * @param tc scheduler context, unused */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct SearchLookup *sl; struct PseuLookupContext *lctx; @@ -678,11 +676,9 @@ handle_sks_zone_identity (void *cls, * is initialized. Initializes up GTK and Glade. * * @param cls handle to the main loop (`struct GNUNET_GTK_MainLoop`) - * @param tc scheduler context, unused */ static void -run (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +run (void *cls) { unsigned long long dl_parallel; unsigned long long req_parallel; diff --git a/src/fs/gnunet-fs-gtk_main-window-search.c b/src/fs/gnunet-fs-gtk_main-window-search.c index 37339c30..3a2273d5 100644 --- a/src/fs/gnunet-fs-gtk_main-window-search.c +++ b/src/fs/gnunet-fs-gtk_main-window-search.c @@ -84,11 +84,9 @@ abort_search_lookup (struct SearchLookup *sl) * the GNS namespace times out. * * @param cls the 'struct SearchLookup' - * @param tc scheduler context */ static void -timeout_search_lookup (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +timeout_search_lookup (void *cls) { struct SearchLookup *sl = cls; @@ -302,11 +300,9 @@ main_window_search_entry_key_press_event_cb (GtkWidget * widget, * Asynchronously clean up PseuLookupContext. * * @param cls the `struct PseuLookupContext` to clean up. - * @param tc scheduler context */ static void -end_pseu_lookup (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +end_pseu_lookup (void *cls) { struct PseuLookupContext *lctx = cls; diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c index a171f32c..450083d7 100644 --- a/src/fs/gnunet-fs-gtk_publish-dialog.c +++ b/src/fs/gnunet-fs-gtk_publish-dialog.c @@ -1457,11 +1457,9 @@ add_share_items_to_treestore (struct AddDirClientContext *adcc, * in a separate task). * * @param cls progress dialog context of our window - * @param tc scheduler context, unused */ static void -stop_scanner_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +stop_scanner_task (void *cls) { struct AddDirClientContext *adcc = cls; diff --git a/src/identity/gnunet-identity-gtk.c b/src/identity/gnunet-identity-gtk.c index ca5668f0..3edb7bb4 100644 --- a/src/identity/gnunet-identity-gtk.c +++ b/src/identity/gnunet-identity-gtk.c @@ -379,10 +379,9 @@ GNUNET_GTK_namespace_organizer_namespaces_treeview_column_name_text_edited_cb * Task run on shutdown. * * @param cls unused - * @param tc scheduler context, unused */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { struct OperationContext *oc; @@ -496,10 +495,9 @@ add_ego (void *cls, * is initialized. Initializes up GTK and Glade. * * @param cls NULL - * @param tc schedule context */ static void -run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +run (void *cls) { GtkWidget *main_window; GtkTreeIter iter; diff --git a/src/lib/animations.c b/src/lib/animations.c index 0f217d1f..16fa883d 100644 --- a/src/lib/animations.c +++ b/src/lib/animations.c @@ -261,11 +261,9 @@ redraw_tree_view (struct GNUNET_GTK_AnimationTreeViewHandle *atv) * Task run periodically to advance all of our animations. * * @param cls closure, unused - * @param tc scheduler context, unused */ static void -ticker (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +ticker (void *cls) { struct GNUNET_GTK_AnimationContext *pos; struct GNUNET_GTK_AnimationTreeViewHandle *atv; diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c index e42d422d..50b294f8 100644 --- a/src/lib/eventloop.c +++ b/src/lib/eventloop.c @@ -323,10 +323,9 @@ GNUNET_GTK_main_loop_get_args (struct GNUNET_GTK_MainLoop * ml, * Task to run Gtk events (within a GNUnet scheduler task). * * @param cls the main loop handle - * @param tc scheduler context */ static void -dispatch_gtk_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +dispatch_gtk_task (void *cls) { struct GNUNET_GTK_MainLoop *ml = cls; @@ -355,7 +354,7 @@ resize_cached_poll_array (struct GNUNET_GTK_MainLoop *ml, guint new_size) * Dummy task to keep our scheduler running. */ static void -keepalive_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +keepalive_task (void *cls) { struct GNUNET_GTK_MainLoop *ml = cls; @@ -854,8 +853,8 @@ run_main_loop (void *cls, char *const *args, const char *cfgfile, GNUNET_asprintf (&baseconfig, "%s%s", ipath, "config.d"); (void) GNUNET_CONFIGURATION_load_from (gcfg, baseconfig); GNUNET_free (baseconfig); - - if (NULL == (ipath2 = GNUNET_GTK_installation_get_path (GNUNET_OS_IPK_DATADIR))) + /* FIXME: this was supposed to search the GTK-IPK, so the logic here is badly broken now */ + if (NULL == (ipath2 = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR))) { GNUNET_break (0); return; diff --git a/src/lib/glade.c b/src/lib/glade.c index 5b508a85..99a9910e 100644 --- a/src/lib/glade.c +++ b/src/lib/glade.c @@ -35,7 +35,7 @@ GNUNET_GTK_set_icon_search_path () { char *buf; - buf = GNUNET_GTK_installation_get_path (GNUNET_OS_IPK_ICONDIR); + buf = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_ICONDIR); gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), buf); GNUNET_free (buf); } @@ -53,7 +53,7 @@ GNUNET_GTK_get_data_dir () static char *dd; if (dd == NULL) - dd = GNUNET_GTK_installation_get_path (GNUNET_OS_IPK_DATADIR); + dd = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); return dd; } diff --git a/src/lib/os_installation.c b/src/lib/os_installation.c index 274ba0ad..9b68b097 100644 --- a/src/lib/os_installation.c +++ b/src/lib/os_installation.c @@ -31,7 +31,7 @@ */ static const struct GNUNET_OS_ProjectData gtk_pd = { .libname = "libgnunetgtk", - .project_dirname = "gnunet-gtk", + .project_dirname = "gnunet", .binary_name = "gnunet-fs-gtk", .env_varname = "GNUNET_GTK_PREFIX", .env_varname_alt = "GNUNET_PREFIX", diff --git a/src/main/gnunet-gtk.c b/src/main/gnunet-gtk.c index 01b27a62..8d01a718 100644 --- a/src/main/gnunet-gtk.c +++ b/src/main/gnunet-gtk.c @@ -127,11 +127,9 @@ get_object (const char *name) * Actual main to tear down the system. * * @param cls the main loop handle - * @param tc scheduler context */ static void -cleanup_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { struct Plug *p; @@ -213,11 +211,9 @@ start_process (struct Plug *p) * Restart crashed plugin process. * * @param cls the `struct Plug` of the plugin - * @param tc scheduler context */ static void -restart_process (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +restart_process (void *cls) { struct Plug *p = cls; @@ -307,11 +303,9 @@ plug (const char *container, * Actual main method that sets up the configuration window. * * @param cls the main loop handle - * @param tc scheduler context */ static void -run (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +run (void *cls) { GtkWidget *main_window; diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am index d30cb2a6..e8320eb8 100644 --- a/src/namestore/Makefile.am +++ b/src/namestore/Makefile.am @@ -1,10 +1,8 @@ # This Makefile.am is in the public domain SUBDIRS = . -# we use libgnunetutil to load plugins, and it -# only looks in /gnunet, not /gnunet-gtk! plugindir = $(libdir)/gnunet -pkgcfgdir= $(prefix)/share/gnunet-gtk/config.d/ +pkgcfgdir= $(prefix)/share/gnunet/config.d/ AM_CPPFLAGS = \ -I$(top_srcdir)/ \ diff --git a/src/namestore/gnunet-namestore-gtk.c b/src/namestore/gnunet-namestore-gtk.c index 20da0446..7f686086 100644 --- a/src/namestore/gnunet-namestore-gtk.c +++ b/src/namestore/gnunet-namestore-gtk.c @@ -2591,11 +2591,9 @@ gnunet_namestore_gtk_zone_combobox_changed_cb (GtkComboBox *widget, * Actual main to tear down the system. * * @param cls the main loop handle - * @param tc scheduler context */ static void -cleanup_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { struct OperationContext *oc; struct MoveOperationContext *moc; @@ -2775,11 +2773,9 @@ identity_cb (void *cls, * Actual main method that sets up the configuration window. * * @param cls the main loop handle - * @param tc scheduler context */ static void -run (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +run (void *cls) { gchar *label; GtkLabel *status_label; diff --git a/src/peerinfo/gnunet-peerinfo-gtk-flags.c b/src/peerinfo/gnunet-peerinfo-gtk-flags.c index 818dc6d5..0a107894 100644 --- a/src/peerinfo/gnunet-peerinfo-gtk-flags.c +++ b/src/peerinfo/gnunet-peerinfo-gtk-flags.c @@ -99,7 +99,7 @@ GNUNET_PEERINFO_GTK_get_flag (const char *cc) mcc = GNUNET_strdup (cc); for (i = 0; i < strlen (mcc); i++) mcc[i] = tolower (mcc[i]); - dir = GNUNET_GTK_installation_get_path (GNUNET_OS_IPK_DATADIR); + dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); GNUNET_asprintf (&fn, "%sflags%s%s.png", dir, DIR_SEPARATOR_STR, mcc); GNUNET_free (dir); diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c b/src/peerinfo/gnunet-peerinfo-gtk.c index 0cca80f0..c98a1839 100644 --- a/src/peerinfo/gnunet-peerinfo-gtk.c +++ b/src/peerinfo/gnunet-peerinfo-gtk.c @@ -1465,7 +1465,7 @@ load_led (const char *color) char *dir; char *fn; - dir = GNUNET_GTK_installation_get_path (GNUNET_OS_IPK_DATADIR); + dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); GNUNET_asprintf (&fn, "%s%s.png", dir, color); GNUNET_free (dir); diff --git a/src/setup/gnunet-setup-transport.c b/src/setup/gnunet-setup-transport.c index 788a2073..c242c50d 100644 --- a/src/setup/gnunet-setup-transport.c +++ b/src/setup/gnunet-setup-transport.c @@ -197,11 +197,9 @@ result_callback (void *cls, * Main function for the connection reversal test. * * @param cls the 'int*' for the result - * @param tc scheduler context */ static void -reversal_test (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +reversal_test (void *cls) { struct GNUNET_SetupAutoContext *ac = cls; diff --git a/src/setup/gnunet-setup.c b/src/setup/gnunet-setup.c index 5a393630..d70f5bf9 100644 --- a/src/setup/gnunet-setup.c +++ b/src/setup/gnunet-setup.c @@ -364,10 +364,9 @@ write_configuration () * Method run on shutdown. * * @param cls the main loop handle - * @param tc scheduler context */ static void -cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +cleanup_task (void *cls) { if (NULL == ml) { @@ -406,11 +405,9 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * * * @param cls closure (unused) - * @param tc scheduler context (unused) */ void -GNUNET_SETUP_restart_namestore (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +GNUNET_SETUP_restart_namestore (void *cls) { if (GNUNET_OK != write_configuration ()) return; /* no point in re-starting namestore ... */ @@ -584,11 +581,9 @@ autoconfig_finished_cb (void *cls) * Actual main method that sets up the configuration window. * * @param cls the main loop handle - * @param tc scheduler context */ static void -run (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +run (void *cls) { GtkWidget *main_window; #ifndef MINGW diff --git a/src/setup/gnunet-setup.h b/src/setup/gnunet-setup.h index 91a14958..40fd6e2e 100644 --- a/src/setup/gnunet-setup.h +++ b/src/setup/gnunet-setup.h @@ -65,11 +65,9 @@ GNUNET_SETUP_get_object (const char *name); * * * @param cls closure (unused) - * @param tc scheduler context (unused) */ void -GNUNET_SETUP_restart_namestore (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +GNUNET_SETUP_restart_namestore (void *cls); /** * Our configuration. -- cgit v1.2.3