From 256ca8aab44a6d6dfc5361c639f606e11eff4ef6 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Thu, 17 Oct 2002 12:58:10 +0000 Subject: [PATCH] r1992: Code tidying (Bernard Jungen). --- ROX-Filer/Help/Changes | 4 + ROX-Filer/src/abox.c | 7 +- ROX-Filer/src/action.c | 417 ++++++++++++++++++-------------------------- ROX-Filer/src/appmenu.c | 3 +- ROX-Filer/src/choices.c | 8 +- ROX-Filer/src/dir.c | 15 +- ROX-Filer/src/diritem.c | 3 +- ROX-Filer/src/display.c | 3 +- ROX-Filer/src/dnd.c | 25 +-- ROX-Filer/src/filer.c | 14 +- ROX-Filer/src/find.c | 8 +- ROX-Filer/src/gui_support.c | 3 +- ROX-Filer/src/i18n.c | 11 +- ROX-Filer/src/menu.c | 29 +-- ROX-Filer/src/options.c | 2 +- ROX-Filer/src/panel.c | 90 ++++------ ROX-Filer/src/pinboard.c | 3 +- ROX-Filer/src/remote.c | 12 +- ROX-Filer/src/sc.c | 11 +- ROX-Filer/src/session.c | 2 +- ROX-Filer/src/support.c | 32 ++-- ROX-Filer/src/support.h | 2 + ROX-Filer/src/tasklist.c | 10 +- ROX-Filer/src/type.c | 12 +- ROX-Filer/src/usericons.c | 6 +- 25 files changed, 288 insertions(+), 444 deletions(-) diff --git a/ROX-Filer/Help/Changes b/ROX-Filer/Help/Changes index a104e65e..8123ddbd 100644 --- a/ROX-Filer/Help/Changes +++ b/ROX-Filer/Help/Changes @@ -2,6 +2,10 @@ A RISC OS-like filer for X by Thomas Leonard +17-Oct-2002 +~~~~~~~~~~~ +Code tidying (Bernard Jungen). + 12-Oct-2002 ~~~~~~~~~~~ Added Swedish translation (Marcus Lundblad). diff --git a/ROX-Filer/src/abox.c b/ROX-Filer/src/abox.c index e2fda950..53dd59e0 100644 --- a/ROX-Filer/src/abox.c +++ b/ROX-Filer/src/abox.c @@ -35,6 +35,7 @@ #include "gui_support.h" #include "filer.h" #include "display.h" +#include "support.h" #define RESPONSE_QUIET 1 @@ -273,8 +274,7 @@ static void abox_finalise(GObject *object) if (abox->next_dir) { - g_free(abox->next_dir); - abox->next_dir = NULL; + null_g_free(&abox->next_dir); gtk_timeout_remove(abox->next_timer); } @@ -289,8 +289,7 @@ static gboolean show_next_dir(gpointer data) ABox *abox = (ABox *) data; gtk_label_set_text(GTK_LABEL(abox->dir_label), abox->next_dir); - g_free(abox->next_dir); - abox->next_dir = NULL; + null_g_free(&abox->next_dir); return FALSE; } diff --git a/ROX-Filer/src/action.c b/ROX-Filer/src/action.c index 250aa966..5a29dd5a 100644 --- a/ROX-Filer/src/action.c +++ b/ROX-Filer/src/action.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "global.h" @@ -121,12 +122,17 @@ static guchar *last_find_string = NULL; static guchar *new_entry_string = NULL; /* Static prototypes */ +static void send_done(void); +static void send_check_path(const gchar *path); +static void send_mount_path(const gchar *path); +static gboolean printf_send(const char *msg, ...); static gboolean send(void); static gboolean send_error(void); static gboolean send_dir(const char *dir); static gboolean read_exact(int source, char *buffer, ssize_t len); static void do_mount(guchar *path, gboolean mount); -static gboolean reply(int fd, gboolean ignore_quiet); +static gboolean printf_reply(int fd, gboolean ignore_quiet, + const char *msg, ...); static gboolean remove_pinned_ok(GList *paths); /* SUPPORT */ @@ -428,10 +434,8 @@ static void for_dir_contents(ForDirCB *cb, if (!d) { /* Message displayed is "ERROR reading 'path': message" */ - g_string_sprintf(message, "!%s '%s': %s\n", - _("ERROR reading"), - src_dir, g_strerror(errno)); - send(); + printf_send("!%s '%s': %s\n", _("ERROR reading"), + src_dir, g_strerror(errno)); return; } @@ -450,14 +454,11 @@ static void for_dir_contents(ForDirCB *cb, if (!list) return; - next = list; - - while (next) + for (next = list; next; next = next->next) { cb((char *) next->data, dest_path); g_free(next->data); - next = next->next; } g_list_free(list); } @@ -477,6 +478,41 @@ static gboolean read_exact(int source, char *buffer, ssize_t len) return TRUE; } +static void send_done(void) +{ + printf_send(_("'\nDone\n")); +} + +/* Notify the filer that this item has been updated */ +static void send_check_path(const gchar *path) +{ + printf_send("s%s", path); +} + +/* Notify the filer that this whole subtree has changed (eg, been unmounted) */ +static void send_mount_path(const gchar *path) +{ + printf_send("m%s", path); +} + +/* Send a message to the filer process. The first character indicates the + * type of the message. + */ +static gboolean printf_send(const char *msg, ...) +{ + va_list args; + gchar *tmp; + + va_start(args, msg); + tmp = g_strdup_vprintf(msg, args); + va_end(args); + + g_string_assign(message, tmp); + g_free(tmp); + + return send(); +} + /* Send 'message' to our parent process. TRUE on success. */ static gboolean send(void) { @@ -495,14 +531,12 @@ static gboolean send(void) /* Set the directory indicator at the top of the window */ static gboolean send_dir(const char *dir) { - g_string_sprintf(message, "/%s", dir); - return send(); + return printf_send("/%s", dir); } static gboolean send_error(void) { - g_string_sprintf(message, "!%s: %s\n", _("ERROR"), g_strerror(errno)); - return send(); + return printf_send("!%s: %s\n", _("ERROR"), g_strerror(errno)); } static void response(GtkDialog *dialog, gint response, GUIside *gui_side) @@ -583,9 +617,7 @@ static void process_flag(char flag) read_new_entry_text(); break; default: - g_string_sprintf(message, - "!ERROR: Bad message '%c'\n", flag); - send(); + printf_send("!ERROR: Bad message '%c'\n", flag); break; } } @@ -624,14 +656,24 @@ static void check_flags(void) * the user MUST click Yes or No, else treat quiet on as Yes. * If the user needs prompting then does send(). */ -static gboolean reply(int fd, gboolean ignore_quiet) +static gboolean printf_reply(int fd, gboolean ignore_quiet, + const char *msg, ...) { ssize_t len; char retval; + va_list args; + gchar *tmp; if (quiet && !ignore_quiet) return TRUE; + va_start(args, msg); + tmp = g_strdup_vprintf(msg, args); + va_end(args); + + g_string_assign(message, tmp); + g_free(tmp); + send(); while (1) @@ -647,12 +689,10 @@ static gboolean reply(int fd, gboolean ignore_quiet) switch (retval) { case 'Y': - g_string_sprintf(message, "' %s\n", _("Yes")); - send(); + printf_send("' %s\n", _("Yes")); return TRUE; case 'N': - g_string_sprintf(message, "' %s\n", _("No")); - send(); + printf_send("' %s\n", _("No")); return FALSE; default: process_flag(retval); @@ -783,8 +823,7 @@ static void do_usage(const char *src_path, const char *unused) if (mc_lstat(src_path, &info)) { - g_string_sprintf(message, "'%s:\n", src_path); - send(); + printf_send("'%s:\n", src_path); send_error(); } else if (S_ISREG(info.st_mode) || S_ISLNK(info.st_mode)) @@ -795,9 +834,8 @@ static void do_usage(const char *src_path, const char *unused) else if (S_ISDIR(info.st_mode)) { dir_counter++; - g_string_sprintf(message, _("?Count contents of %s?"), - src_path); - if (reply(from_parent, FALSE)) + if (printf_reply(from_parent, FALSE, + _("?Count contents of %s?"), src_path)) { char *safe_path; safe_path = g_strdup(src_path); @@ -828,17 +866,14 @@ static void do_delete(const char *src_path, const char *unused) : access(src_path, W_OK) != 0; if (write_prot || !quiet) { - g_string_sprintf(message, _("?Delete %s'%s'?"), - write_prot ? _("WRITE-PROTECTED ") : "", - src_path); - if (!reply(from_parent, write_prot && !o_force)) + if (!printf_reply(from_parent, write_prot && !o_force, + _("?Delete %s'%s'?"), + write_prot ? _("WRITE-PROTECTED ") : "", + src_path)) return; } else if (!o_brief) - { - g_string_sprintf(message, _("'Deleting '%s'\n"), src_path); - send(); - } + printf_send(_("'Deleting '%s'\n"), src_path); safe_path = g_strdup(src_path); @@ -851,25 +886,20 @@ static void do_delete(const char *src_path, const char *unused) send_error(); return; } - g_string_sprintf(message, _("'Directory '%s' deleted\n"), - safe_path); - send(); - g_string_sprintf(message, "m%s", safe_path); - send(); + printf_send(_("'Directory '%s' deleted\n"), safe_path); + send_mount_path(safe_path); } else if (unlink(src_path)) send_error(); else { - g_string_sprintf(message, "s%s", safe_path); - send(); + send_check_path(safe_path); if (strcmp(g_basename(safe_path), ".DirIcon") == 0) { gchar *dir; dir = g_dirname(safe_path); - g_string_sprintf(message, "s%s", dir); + send_check_path(dir); g_free(dir); - send(); } } @@ -887,8 +917,7 @@ static void do_find(const char *path, const char *unused) if (!quiet) { - g_string_sprintf(message, _("?Check '%s'?"), path); - if (!reply(from_parent, FALSE)) + if (!printf_reply(from_parent, FALSE, _("?Check '%s'?"), path)) return; } @@ -896,29 +925,25 @@ static void do_find(const char *path, const char *unused) { if (new_entry_string) { - if (find_condition) - find_condition_free(find_condition); + find_condition_free(find_condition); find_condition = find_compile(new_entry_string); - g_free(new_entry_string); - new_entry_string = NULL; + null_g_free(&new_entry_string); } if (find_condition) break; - g_string_assign(message, _("!Invalid find condition - " - "change it and try again\n")); - send(); - g_string_sprintf(message, _("?Check '%s'?"), path); - if (!reply(from_parent, TRUE)) + printf_send(_("!Invalid find condition - " + "change it and try again\n")); + if (!printf_reply(from_parent, TRUE, + _("?Check '%s'?"), path)) return; } if (mc_lstat(path, &info.stats)) { send_error(); - g_string_sprintf(message, _("'(while checking '%s')\n"), path); - send(); + printf_send(_("'(while checking '%s')\n"), path); return; } @@ -928,10 +953,7 @@ static void do_find(const char *path, const char *unused) info.leaf = g_basename(path); info.prune = FALSE; if (find_test_condition(find_condition, &info)) - { - g_string_sprintf(message, "=%s", path); - send(); - } + printf_send("=%s", path); if (S_ISDIR(info.stats.st_mode) && !info.prune) { @@ -991,18 +1013,12 @@ static void do_chmod(const char *path, const char *unused) if (!quiet) { - g_string_sprintf(message, - _("?Change permissions of '%s'?"), path); - if (!reply(from_parent, FALSE)) + if (!printf_reply(from_parent, FALSE, + _("?Change permissions of '%s'?"), path)) return; } else if (!o_brief) - { - g_string_sprintf(message, - _("'Changing permissions of '%s'\n"), - path); - send(); - } + printf_send(_("'Changing permissions of '%s'\n"), path); for (;;) { @@ -1012,19 +1028,16 @@ static void do_chmod(const char *path, const char *unused) mode_free(mode_change); mode_change = nice_mode_compile(new_entry_string, MODE_MASK_ALL); - g_free(new_entry_string); - new_entry_string = NULL; + null_g_free(&new_entry_string); } if (mode_change) break; - g_string_assign(message, + printf_send( _("!Invalid mode command - change it and try again\n")); - send(); - g_string_sprintf(message, - _("?Change permissions of '%s'?"), path); - if (!reply(from_parent, TRUE)) + if (!printf_reply(from_parent, TRUE, + _("?Change permissions of '%s'?"), path)) return; } @@ -1043,13 +1056,11 @@ static void do_chmod(const char *path, const char *unused) return; } - g_string_sprintf(message, "s%s", path); - send(); + send_check_path(path); if (S_ISDIR(info.st_mode)) { - g_string_sprintf(message, "m%s", path); - send(); + send_mount_path(path); if (o_recurse) { @@ -1109,15 +1120,15 @@ static void do_copy2(const char *path, const char *dest) if (!merge && o_newer && info.st_mtime > dest_info.st_mtime) { - /* Newer; keep going */ + /* Newer; keep going */ } else { - g_string_sprintf(message, - _("?'%s' already exists - %s?"), dest_path, - merge ? _("merge contents") : _("overwrite")); - - if (!reply(from_parent, TRUE)) + if (!printf_reply(from_parent, TRUE, + _("?'%s' already exists - %s?"), + dest_path, + merge ? _("merge contents") + : _("overwrite"))) return; } @@ -1133,25 +1144,18 @@ static void do_copy2(const char *path, const char *dest) send_error(); if (errno != ENOENT) return; - g_string_sprintf(message, - _("'Trying copy anyway...\n")); - send(); + printf_send(_("'Trying copy anyway...\n")); } } } else if (!quiet) { - g_string_sprintf(message, - _("?Copy %s as %s?"), path, dest_path); - if (!reply(from_parent, FALSE)) + if (!printf_reply(from_parent, FALSE, + _("?Copy %s as %s?"), path, dest_path)) return; } else - { - g_string_sprintf(message, _("'Copying %s as %s\n"), path, - dest_path); - send(); - } + printf_send(_("'Copying %s as %s\n"), path, dest_path); if (S_ISDIR(info.st_mode)) { @@ -1166,22 +1170,15 @@ static void do_copy2(const char *path, const char *dest) exists = !mc_lstat(dest_path, &dest_info); if (exists && !S_ISDIR(dest_info.st_mode)) - { - g_string_sprintf(message, - _("!ERROR: Destination already exists, " - "but is not a directory\n")); - send(); - } + printf_send(_("!ERROR: Destination already exists, " + "but is not a directory\n")); else if (exists == FALSE && mkdir(dest_path, 0700 | mode)) send_error(); else { if (!exists) - { /* (just been created then) */ - g_string_sprintf(message, "s%s", dest_path); - send(); - } + send_check_path(dest_path); action_leaf = NULL; for_dir_contents(do_copy2, safe_path, safe_dest); @@ -1230,10 +1227,7 @@ static void do_copy2(const char *path, const char *dest) if (symlink(target, dest_path)) send_error(); else - { - g_string_sprintf(message, "s%s", dest_path); - send(); - } + send_check_path(dest_path); g_free(target); } @@ -1248,16 +1242,11 @@ static void do_copy2(const char *path, const char *dest) if (error) { - g_string_sprintf(message, _("!%s\nFailed to copy '%s'"), - error, path); + printf_send(_("!%s\nFailed to copy '%s'"), error, path); g_free(error); - send(); } else - { - g_string_sprintf(message, "s%s", dest_path); - send(); - } + send_check_path(dest_path); } } @@ -1291,14 +1280,10 @@ static void do_move2(const char *path, const char *dest) { /* Newer; keep going */ } - else - { - g_string_sprintf(message, - _("?'%s' already exists - overwrite?"), - dest_path); - if (!reply(from_parent, TRUE)) - return; - } + else if (!printf_reply(from_parent, TRUE, + _("?'%s' already exists - overwrite?"), + dest_path)) + return; if (S_ISDIR(info.st_mode)) err = rmdir(dest_path); @@ -1310,24 +1295,17 @@ static void do_move2(const char *path, const char *dest) send_error(); if (errno != ENOENT) return; - g_string_sprintf(message, - _("'Trying move anyway...\n")); - send(); + printf_send(_("'Trying move anyway...\n")); } } else if (!quiet) { - g_string_sprintf(message, - _("?Move %s as %s?"), path, dest_path); - if (!reply(from_parent, FALSE)) + if (!printf_reply(from_parent, FALSE, + _("?Move %s as %s?"), path, dest_path)) return; } else - { - g_string_sprintf(message, _("'Moving %s as %s\n"), path, - dest_path); - send(); - } + printf_send(_("'Moving %s as %s\n"), path, dest_path); argv[2] = path; argv[3] = dest_path; @@ -1335,24 +1313,18 @@ static void do_move2(const char *path, const char *dest) err = fork_exec_wait(argv); if (err) { - g_string_sprintf(message, - _("!%s\nFailed to move %s as %s\n"), - err, path, dest_path); - send(); - + printf_send(_("!%s\nFailed to move %s as %s\n"), + err, path, dest_path); g_free(err); } else { - g_string_sprintf(message, "s%s", dest_path); - send(); + send_check_path(dest_path); if (is_dir) - g_string_sprintf(message, "m%s", path); + send_mount_path(path); else - g_string_sprintf(message, "s%s", path); - - send(); + send_check_path(path); } } @@ -1362,11 +1334,7 @@ static void do_move2(const char *path, const char *dest) static void do_copy(const char *path, const char *dest) { if (is_sub_dir(make_dest_path(path, dest), path)) - { - g_string_sprintf(message, - _("!ERROR: Can't copy object into itself\n")); - send(); - } + printf_send(_("!ERROR: Can't copy object into itself\n")); else do_copy2(path, dest); } @@ -1377,11 +1345,8 @@ static void do_copy(const char *path, const char *dest) static void do_move(const char *path, const char *dest) { if (is_sub_dir(make_dest_path(path, dest), path)) - { - g_string_sprintf(message, - _("!ERROR: Can't move/rename object into itself\n")); - send(); - } + printf_send( + _("!ERROR: Can't move/rename object into itself\n")); else do_move2(path, dest); } @@ -1395,26 +1360,15 @@ static void do_link(const char *path, const char *dest) dest_path = make_dest_path(path, dest); if (quiet) - { - g_string_sprintf(message, _("'Linking %s as %s\n"), path, - dest_path); - send(); - } - else - { - g_string_sprintf(message, - _("?Link %s as %s?"), path, dest_path); - if (!reply(from_parent, FALSE)) - return; - } + printf_send(_("'Linking %s as %s\n"), path, dest_path); + else if (!printf_reply(from_parent, FALSE, + _("?Link %s as %s?"), path, dest_path)) + return; if (symlink(path, dest_path)) send_error(); else - { - g_string_sprintf(message, "s%s", dest_path); - send(); - } + send_check_path(dest_path); } /* Mount/umount this item (depending on 'mount') */ @@ -1429,41 +1383,28 @@ static void do_mount(guchar *path, gboolean mount) argv[1] = path; if (quiet) - { - g_string_sprintf(message, - mount ? _("'Mounting %s\n") - : _("'Unmounting %s\n"), - path); - send(); - } - else - { - g_string_sprintf(message, - mount ? _("?Mount %s?") - : _("?Unmount %s?"), - path); - if (!reply(from_parent, FALSE)) - return; - } + printf_send(mount ? _("'Mounting %s\n") + : _("'Unmounting %s\n"), + path); + else if (!printf_reply(from_parent, FALSE, + mount ? _("?Mount %s?") + : _("?Unmount %s?"), + path)) + return; err = fork_exec_wait(argv); if (err) { - g_string_sprintf(message, mount ? + printf_send(mount ? _("!%s\nMount failed\n") : _("!%s\nUnmount failed\n"), err); - send(); g_free(err); } else { - g_string_sprintf(message, "M%s", path); - send(); + printf_send("M%s", path); if (mount && mount_open_dir) - { - g_string_sprintf(message, "o%s", path); - send(); - } + printf_send("o%s", path); } } @@ -1476,7 +1417,6 @@ static void usage_cb(gpointer data) { GList *paths = (GList *) data; double total_size = 0; - gchar *tmp; dir_counter = file_counter = 0; @@ -1490,37 +1430,28 @@ static void usage_cb(gpointer data) do_usage(path, NULL); - g_string_sprintf(message, "'%s: %s\n", - g_basename(path), - format_double_size(size_tally)); - send(); + printf_send("'%s: %s\n", + g_basename(path), + format_double_size(size_tally)); total_size += size_tally; } - g_string_sprintf(message, _("'\nTotal: %s ("), - format_double_size(total_size)); + g_string_printf(message, _("'\nTotal: %s ("), + format_double_size(total_size)); if (file_counter) - { - tmp = g_strdup_printf("%ld %s%s", - file_counter, + g_string_append_printf(message, + "%ld %s%s", file_counter, file_counter == 1 ? _("file") : _("files"), dir_counter ? ", " : ")\n"); - g_string_append(message, tmp); - g_free(tmp); - } if (file_counter == 0 && dir_counter == 0) g_string_append(message, _("no directories)\n")); else if (dir_counter) - { - tmp = g_strdup_printf("%ld %s)\n", - dir_counter, + g_string_append_printf(message, + "%ld %s)\n", dir_counter, dir_counter == 1 ? _("directory") : _("directories")); - g_string_append(message, tmp); - g_free(tmp); - } send(); } @@ -1545,10 +1476,10 @@ static void mount_cb(gpointer data) mount_points = TRUE; } - g_string_sprintf(message, - mount_points ? _("'\nDone\n") - : _("!No mount points selected!\n")); - send(); + if (mount_points) + send_done(); + else + printf_send(_("!No mount points selected!\n")); } #endif @@ -1569,7 +1500,7 @@ static void delete_cb(gpointer data) { GList *paths = (GList *) data; - while (paths) + for (; paths; paths = paths->next) { guchar *path = (guchar *) paths->data; guchar *dir; @@ -1580,11 +1511,9 @@ static void delete_cb(gpointer data) do_delete(path, dir); g_free(dir); - paths = paths->next; } - g_string_sprintf(message, _("'\nDone\n")); - send(); + send_done(); } static void find_cb(gpointer data) @@ -1603,15 +1532,13 @@ static void find_cb(gpointer data) do_find(path, NULL); } - g_string_assign(message, _("?Another search?")); - if (!reply(from_parent, TRUE)) + if (!printf_reply(from_parent, TRUE, + _("?Another search?"))) break; - g_string_assign(message, "#"); - send(); + printf_send("#"); } - g_string_sprintf(message, _("'\nDone\n")); - send(); + send_done(); } static void chmod_cb(gpointer data) @@ -1628,35 +1555,27 @@ static void chmod_cb(gpointer data) if (mc_stat(path, &info) != 0) send_error(); else if (S_ISLNK(info.st_mode)) - { - g_string_sprintf(message, - _("!'%s' is a symbolic link\n"), - g_basename(path)); - send(); - } + printf_send(_("!'%s' is a symbolic link\n"), + g_basename(path)); else do_chmod(path, NULL); } - g_string_sprintf(message, _("'\nDone\n")); - send(); + send_done(); } static void list_cb(gpointer data) { GList *paths = (GList *) data; - while (paths) + for (; paths; paths = paths->next) { send_dir((char *) paths->data); action_do_func((char *) paths->data, action_dest); - - paths = paths->next; } - g_string_sprintf(message, _("'\nDone\n")); - send(); + send_done(); } /* EXTERNAL INTERFACE */ @@ -1865,8 +1784,7 @@ void action_chmod(GList *paths, gboolean force_recurse, const char *action) gtk_widget_show(abox); out: - g_free(new_entry_string); - new_entry_string = NULL; + null_g_free(&new_entry_string); } /* If leaf is NULL then the copy has the same name as the original. @@ -1985,7 +1903,7 @@ static gboolean remove_pinned_ok(GList *paths) int i, ask_n = 0; gboolean retval; - while (paths) + for (; paths; paths = paths->next) { guchar *path = (guchar *) paths->data; @@ -1995,8 +1913,6 @@ static gboolean remove_pinned_ok(GList *paths) break; ask = g_list_append(ask, path); } - - paths = paths->next; } if (!ask) @@ -2064,6 +1980,5 @@ void set_find_string_colour(GtkWidget *widget, const guchar *string) cond = find_compile(string); entry_set_error(widget, !cond); - if (cond) - find_condition_free(cond); + find_condition_free(cond); } diff --git a/ROX-Filer/src/appmenu.c b/ROX-Filer/src/appmenu.c index b59a502f..882166a3 100644 --- a/ROX-Filer/src/appmenu.c +++ b/ROX-Filer/src/appmenu.c @@ -70,8 +70,7 @@ void appmenu_remove(void) for (next = current_items; next; next = next->next) gtk_widget_destroy((GtkWidget *) next->data); - g_free(current_app_path); - current_app_path = NULL; + null_g_free(¤t_app_path); current_menu = NULL; g_list_free(current_items); diff --git a/ROX-Filer/src/choices.c b/ROX-Filer/src/choices.c index 15077353..35def4d0 100644 --- a/ROX-Filer/src/choices.c +++ b/ROX-Filer/src/choices.c @@ -116,7 +116,7 @@ GPtrArray *choices_list_dirs(char *dir) list = g_ptr_array_new(); - while (*cdir) + for (; *cdir; cdir++) { guchar *path; @@ -125,8 +125,6 @@ GPtrArray *choices_list_dirs(char *dir) g_ptr_array_add(list, path); else g_free(path); - - cdir++; } return list; @@ -158,7 +156,7 @@ guchar *choices_find_path_load(const char *leaf, const char *dir) g_return_val_if_fail(dir_list != NULL, NULL); - while (*cdir) + for (; *cdir; cdir++) { gchar *path; @@ -168,8 +166,6 @@ guchar *choices_find_path_load(const char *leaf, const char *dir) return path; g_free(path); - - cdir++; } return NULL; diff --git a/ROX-Filer/src/dir.c b/ROX-Filer/src/dir.c index 1f625f95..c5044f18 100644 --- a/ROX-Filer/src/dir.c +++ b/ROX-Filer/src/dir.c @@ -238,14 +238,7 @@ static int sort_names(const void *a, const void *b) static void free_recheck_list(Directory *dir) { - GList *next; - - for (next = dir->recheck_list; next; next = next->next) - g_free(next->data); - - g_list_free(dir->recheck_list); - - dir->recheck_list = NULL; + destroy_glist(&dir->recheck_list); } /* If scanning state has changed then notify all filer windows */ @@ -332,11 +325,7 @@ void dir_rescan(Directory *dir, const guchar *pathname) read_globicons(); mount_update(FALSE); - if (dir->error) - { - g_free(dir->error); - dir->error = NULL; - } + null_g_free(&dir->error); /* Saves statting the parent for each item... */ if (mc_stat(pathname, &dir->stat_info)) diff --git a/ROX-Filer/src/diritem.c b/ROX-Filer/src/diritem.c index 8390b022..d16fc544 100644 --- a/ROX-Filer/src/diritem.c +++ b/ROX-Filer/src/diritem.c @@ -262,8 +262,7 @@ void diritem_free(DirItem *item) item->image = NULL; if (item->leafname_collate != item->leafname) g_free(item->leafname_collate); - g_free(item->leafname); - item->leafname = NULL; + null_g_free(&item->leafname); g_free(item); } diff --git a/ROX-Filer/src/display.c b/ROX-Filer/src/display.c index 9c33909d..b154c1bd 100644 --- a/ROX-Filer/src/display.c +++ b/ROX-Filer/src/display.c @@ -366,8 +366,7 @@ void display_set_autoselect(FilerWindow *filer_window, const gchar *leaf) new = g_strdup(leaf); /* leaf == old value sometimes */ - g_free(filer_window->auto_select); - filer_window->auto_select = NULL; + null_g_free(&filer_window->auto_select); if (view_autoselect(filer_window->view, new)) g_free(new); diff --git a/ROX-Filer/src/dnd.c b/ROX-Filer/src/dnd.c index a30d0786..0bab131e 100644 --- a/ROX-Filer/src/dnd.c +++ b/ROX-Filer/src/dnd.c @@ -529,9 +529,7 @@ static gboolean drag_drop(GtkWidget *widget, { error = _("XDS protocol error: " "leafname may not contain '/'\n"); - g_free(leafname); - - leafname = NULL; + null_g_free(&leafname); } else { @@ -848,7 +846,6 @@ static void got_uri_list(GtkWidget *widget, else { GList *local_paths = NULL; - GList *next; /* Either one local URI, or a list. If everything in the list * isn't local then we are stuck. @@ -886,9 +883,7 @@ static void got_uri_list(GtkWidget *widget, else error = _("Unknown action requested"); - for (next = local_paths; next; next = next->next) - g_free(next->data); - g_list_free(local_paths); + destroy_glist(&local_paths); } if (error) @@ -899,13 +894,7 @@ static void got_uri_list(GtkWidget *widget, else if (send_reply) gtk_drag_finish(context, TRUE, FALSE, time); /* Success! */ - next_uri = uri_list; - while (next_uri) - { - g_free(next_uri->data); - next_uri = next_uri->next; - } - g_list_free(uri_list); + destroy_glist(&uri_list); } /* Called when an item from the ACTION_ASK menu is chosen */ @@ -937,12 +926,8 @@ static void prompt_action(GList *paths, gchar *dest) if (prompt_local_paths) { - g_list_foreach(prompt_local_paths, (GFunc) g_free, NULL); - g_list_free(prompt_local_paths); - g_free(prompt_dest_path); - - prompt_dest_path = NULL; - prompt_local_paths = NULL; + destroy_glist(&prompt_local_paths); + null_g_free(&prompt_dest_path); } /* Make a copy of the arguments */ diff --git a/ROX-Filer/src/filer.c b/ROX-Filer/src/filer.c index 55ed46bd..dda51286 100644 --- a/ROX-Filer/src/filer.c +++ b/ROX-Filer/src/filer.c @@ -274,6 +274,8 @@ static void update_display(Directory *dir, break; case DIR_REMOVE: view_delete_if(view, if_deleted, items); + /* XXX: Slow? */ + toolbar_update_info(filer_window); break; case DIR_START_SCAN: set_scanning_display(filer_window, TRUE); @@ -301,8 +303,7 @@ static void update_display(Directory *dir, if (filer_window->auto_select) display_set_autoselect(filer_window, filer_window->auto_select); - g_free(filer_window->auto_select); - filer_window->auto_select = NULL; + null_g_free(&filer_window->auto_select); filer_create_thumbs(filer_window); @@ -361,10 +362,7 @@ static void filer_window_destroyed(GtkWidget *widget, } if (filer_window->thumb_queue) - { - g_list_foreach(filer_window->thumb_queue, (GFunc) g_free, NULL); - g_list_free(filer_window->thumb_queue); - } + destroy_glist(&filer_window->thumb_queue); tooltip_show(NULL); @@ -1561,9 +1559,7 @@ void filer_cancel_thumbnails(FilerWindow *filer_window) { gtk_widget_hide(filer_window->thumb_bar); - g_list_foreach(filer_window->thumb_queue, (GFunc) g_free, NULL); - g_list_free(filer_window->thumb_queue); - filer_window->thumb_queue = NULL; + destroy_glist(&filer_window->thumb_queue); filer_window->max_thumbs = 0; } diff --git a/ROX-Filer/src/find.c b/ROX-Filer/src/find.c index 0c69fa86..c5c14bec 100644 --- a/ROX-Filer/src/find.c +++ b/ROX-Filer/src/find.c @@ -172,9 +172,8 @@ gboolean find_test_condition(FindCondition *condition, FindInfo *info) void find_condition_free(FindCondition *condition) { - g_return_if_fail(condition != NULL); - - condition->free(condition); + if (condition) + condition->free(condition); } /**************************************************************** @@ -705,8 +704,7 @@ static FindCondition *parse_dash(const gchar **expression) case 'o': test = IS_MINE; break; case 'z': test = IS_EMPTY; break; default: - if (retval) - find_condition_free(retval); + find_condition_free(retval); return NULL; } i++; diff --git a/ROX-Filer/src/gui_support.c b/ROX-Filer/src/gui_support.c index 82485b9a..2038a5ea 100644 --- a/ROX-Filer/src/gui_support.c +++ b/ROX-Filer/src/gui_support.c @@ -259,8 +259,7 @@ static gboolean error_idle_cb(gpointer data) char **error = (char **) data; report_error("%s", *error); - g_free(*error); - *error = NULL; + null_g_free(error); one_less_window(); return FALSE; diff --git a/ROX-Filer/src/i18n.c b/ROX-Filer/src/i18n.c index 3bd05deb..685ca090 100644 --- a/ROX-Filer/src/i18n.c +++ b/ROX-Filer/src/i18n.c @@ -112,8 +112,7 @@ GtkItemFactoryEntry *translate_entries(GtkItemFactoryEntry *entries, gint n) ret[i].path = trans; g_free(first); - g_free(second); - second = NULL; + null_g_free(&second); trans++; slash = strchr(trans, '/'); @@ -182,12 +181,8 @@ static void set_trans(guchar *lang) rox_clear_translation(); - if (current_lang) - { - g_free(current_lang); - current_lang = NULL; - } - + null_g_free(¤t_lang); + if (strcmp(lang, "None") == 0) return; else if (strcmp(lang, "From LANG") == 0) diff --git a/ROX-Filer/src/menu.c b/ROX-Filer/src/menu.c index 8d90513f..94564c38 100644 --- a/ROX-Filer/src/menu.c +++ b/ROX-Filer/src/menu.c @@ -365,8 +365,7 @@ static void menuitem_no_shortcuts(GtkWidget *item) GtkMenuItem *menuitem = GTK_MENU_ITEM(item); _gtk_widget_set_accel_path(item, NULL, NULL); - g_free(menuitem->accel_path); - menuitem->accel_path = NULL; + null_g_free(&menuitem->accel_path); #endif } @@ -940,8 +939,7 @@ static void delete(FilerWindow *filer_window) GList *paths; paths = filer_selected_items(filer_window); action_delete(paths); - g_list_foreach(paths, (GFunc) g_free, NULL); - g_list_free(paths); + destroy_glist(&paths); } static void usage(FilerWindow *filer_window) @@ -949,8 +947,7 @@ static void usage(FilerWindow *filer_window) GList *paths; paths = filer_selected_items(filer_window); action_usage(paths); - g_list_foreach(paths, (GFunc) g_free, NULL); - g_list_free(paths); + destroy_glist(&paths); } static void chmod_items(FilerWindow *filer_window) @@ -958,8 +955,7 @@ static void chmod_items(FilerWindow *filer_window) GList *paths; paths = filer_selected_items(filer_window); action_chmod(paths, FALSE, NULL); - g_list_foreach(paths, (GFunc) g_free, NULL); - g_list_free(paths); + destroy_glist(&paths); } static void find(FilerWindow *filer_window) @@ -967,8 +963,7 @@ static void find(FilerWindow *filer_window) GList *paths; paths = filer_selected_items(filer_window); action_find(paths); - g_list_foreach(paths, (GFunc) g_free, NULL); - g_list_free(paths); + destroy_glist(&paths); } /* This creates a new savebox widget, and allows the user to pick a new path @@ -1492,10 +1487,8 @@ static void show_send_to_menu(GList *paths, GdkEvent *event) gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); if (send_to_paths) - { - g_list_foreach(send_to_paths, (GFunc) g_free, NULL); - g_list_free(send_to_paths); - } + destroy_glist(&send_to_paths); + send_to_paths = paths; g_signal_connect(menu, "unmap_event", G_CALLBACK(menu_closed), NULL); @@ -1703,10 +1696,7 @@ void menu_rox_help(gpointer data, guint action, GtkWidget *widget) manual = g_strconcat(app_dir, "/Help/Manual-", current_lang, ".html", NULL); if (access(manual, F_OK)) - { - g_free(manual); - manual = NULL; - } + null_g_free(&manual); } if (!manual) @@ -1855,8 +1845,7 @@ static void file_op(gpointer data, FileOp action, GtkWidget *unused) items = filer_selected_items(window_with_focus); infobox_show_list(items); - g_list_foreach(items, (GFunc) g_free, NULL); - g_list_free(items); + destroy_glist(&items); return; } default: diff --git a/ROX-Filer/src/options.c b/ROX-Filer/src/options.c index e362999d..c2134de3 100644 --- a/ROX-Filer/src/options.c +++ b/ROX-Filer/src/options.c @@ -751,7 +751,7 @@ static void build_options_window(void) if (!options_doc) { - report_error("Internal error: %s unreadable", path); + report_error(_("Internal error: %s unreadable"), path); g_free(path); return; } diff --git a/ROX-Filer/src/panel.c b/ROX-Filer/src/panel.c index 47251689..b334863d 100644 --- a/ROX-Filer/src/panel.c +++ b/ROX-Filer/src/panel.c @@ -1269,6 +1269,31 @@ static gint icon_motion_event(GtkWidget *widget, return TRUE; } +static void reposition_icon_on_side(GtkWidget *side, GtkWidget *widget, + int index) +{ + GList *list; + + list = gtk_container_get_children(GTK_CONTAINER(side)); + + /* Want to move icon to the list in the given 'side'. Is it there + * already? + */ + + if (!g_list_find(list, widget)) + { + /* No, reparent */ + gtk_grab_remove(widget); + gtk_widget_reparent(widget, side); + dnd_motion_grab_pointer(); + gtk_grab_add(widget); + } + + gtk_box_reorder_child(GTK_BOX(side), widget, index); + + g_list_free(list); +} + /* Move icon to this index in the complete widget list. * 0 makes the icon the left-most icon. The gap in the middle has * an index number, which allows you to specify that the icon should @@ -1283,47 +1308,13 @@ static void reposition_icon(PanelIcon *pi, int index) list = gtk_container_get_children(GTK_CONTAINER(panel->before)); before_len = g_list_length(list); + g_list_free(list); if (index <= before_len) - { - /* Want to move icon to the 'before' list. Is it there - * already? - */ - - if (!g_list_find(list, widget)) - { - /* No, reparent */ - gtk_grab_remove(widget); - gtk_widget_reparent(widget, panel->before); - dnd_motion_grab_pointer(); - gtk_grab_add(widget); - } - - gtk_box_reorder_child(GTK_BOX(panel->before), widget, index); - } + reposition_icon_on_side(panel->before, widget, index); else - { - /* Else, we need it in the 'after' list. */ - - index -= before_len + 1; - - g_list_free(list); - - list = gtk_container_get_children(GTK_CONTAINER(panel->after)); - - if (!g_list_find(list, widget)) - { - /* Not already there, reparent */ - gtk_grab_remove(widget); - gtk_widget_reparent(widget, panel->after); - dnd_motion_grab_pointer(); - gtk_grab_add(widget); - } - - gtk_box_reorder_child(GTK_BOX(panel->after), widget, index); - } - - g_list_free(list); + reposition_icon_on_side(panel->after, widget, + index - (before_len + 1)); panel_save(panel); } @@ -1500,21 +1491,11 @@ static void panel_post_resize(GtkWidget *win, GtkRequisition *req, Panel *panel) } } -/* Tips or style has changed -- update everything on this panel */ -static void panel_set_style(Panel *panel) +static void update_side(GtkWidget *side) { GList *kids, *next; - kids = gtk_container_get_children(GTK_CONTAINER(panel->before)); - for (next = kids; next; next = next->next) - { - PanelIcon *pi; - pi = g_object_get_data(next->data, "icon"); - panel_icon_set_tip(pi); - } - g_list_free(kids); - - kids = gtk_container_get_children(GTK_CONTAINER(panel->after)); + kids = gtk_container_get_children(GTK_CONTAINER(side)); for (next = kids; next; next = next->next) { PanelIcon *pi; @@ -1522,7 +1503,13 @@ static void panel_set_style(Panel *panel) panel_icon_set_tip(pi); } g_list_free(kids); +} +/* Tips or style has changed -- update everything on this panel */ +static void panel_set_style(Panel *panel) +{ + update_side(panel->before); + update_side(panel->after); gtk_widget_queue_resize(panel->window); } @@ -1776,11 +1763,10 @@ static void panel_position_menu(GtkMenu *menu, gint *x, gint *y, static void panel_show_menu(GdkEventButton *event, PanelIcon *pi, Panel *panel) { PanelSide side = panel->side; - int pos[3]; + int pos[2]; pos[0] = event->x_root; pos[1] = event->y_root; - pos[2] = 1; icon_prepare_menu((Icon *) pi, FALSE); diff --git a/ROX-Filer/src/pinboard.c b/ROX-Filer/src/pinboard.c index 9bd820eb..afcc6196 100644 --- a/ROX-Filer/src/pinboard.c +++ b/ROX-Filer/src/pinboard.c @@ -1659,8 +1659,7 @@ static void pinboard_clear(void) abandon_backdrop_app(current_pinboard); g_free(current_pinboard->name); - g_free(current_pinboard); - current_pinboard = NULL; + null_g_free(¤t_pinboard); number_of_windows--; } diff --git a/ROX-Filer/src/remote.c b/ROX-Filer/src/remote.c index 1311526a..185c426c 100644 --- a/ROX-Filer/src/remote.c +++ b/ROX-Filer/src/remote.c @@ -798,8 +798,7 @@ static xmlNodePtr rpc_Copy(GList *args) if (from) action_copy(from, to, leaf, quiet); - g_list_foreach(from, (GFunc) g_free, NULL); - g_list_free(from); + destroy_glist(&from); g_free(to); g_free(leaf); @@ -821,8 +820,7 @@ static xmlNodePtr rpc_Move(GList *args) if (from) action_move(from, to, leaf, quiet); - g_list_foreach(from, (GFunc) g_free, NULL); - g_list_free(from); + destroy_glist(&from); g_free(to); g_free(leaf); @@ -842,8 +840,7 @@ static xmlNodePtr rpc_Link(GList *args) if (from) action_link(from, to, leaf); - g_list_foreach(from, (GFunc) g_free, NULL); - g_list_free(from); + destroy_glist(&from); g_free(to); g_free(leaf); @@ -885,8 +882,7 @@ static xmlNodePtr rpc_Mount(GList *args) if (paths) action_mount(paths, open_dir, quiet); - g_list_foreach(paths, (GFunc) g_free, NULL); - g_list_free(paths); + destroy_glist(&paths); return NULL; } diff --git a/ROX-Filer/src/sc.c b/ROX-Filer/src/sc.c index c9d4be0b..9aedf2e5 100644 --- a/ROX-Filer/src/sc.c +++ b/ROX-Filer/src/sc.c @@ -69,12 +69,11 @@ static SmProperty *find_property(SmClient *client, const gchar *name) GSList *list = client->props; SmProperty *prop; - while(list) + for (; list; list = list->next) { prop = (SmProperty *)list->data; - if(strcmp(prop->prop.name, name) == 0) + if (strcmp(prop->prop.name, name) == 0) return prop; - list = g_slist_next(list); } return NULL; } @@ -229,7 +228,7 @@ void sc_destroy(SmClient *client) #ifdef DEBUG g_printerr("destroying client\n"); #endif - while(list) + for (; list; list = list->next) { prop = (SmProperty *)list->data; g_free(prop->prop.vals->value); @@ -237,7 +236,6 @@ void sc_destroy(SmClient *client) g_free(prop->prop.name); g_free(prop->prop.type); g_free(prop); - list = g_slist_next(list); } g_slist_free(client->props); g_free(client->id); @@ -340,7 +338,7 @@ void sc_register_properties(SmClient *client) gint i; #endif - while(list) + for (; list; list = list->next) { prop = (SmProperty *)list->data; if(prop->set == TRUE) @@ -348,7 +346,6 @@ void sc_register_properties(SmClient *client) g_ptr_array_add(set_props, &prop->prop); prop->set = FALSE; } - list = g_slist_next(list); } #ifdef DEBUG g_printerr("Registering props:\n"); diff --git a/ROX-Filer/src/session.c b/ROX-Filer/src/session.c index 990ac922..3fde27c4 100644 --- a/ROX-Filer/src/session.c +++ b/ROX-Filer/src/session.c @@ -53,7 +53,7 @@ static void save_state(SmClient *client) g_ptr_array_add(restart_cmd, "-c"); g_ptr_array_add(restart_cmd, client->id); - for(list = all_filer_windows; list != NULL; list = g_list_next(list)) + for (list = all_filer_windows; list; list = list->next) { filer_window = (FilerWindow *)list->data; gdk_window_set_role(filer_window->window->window, diff --git a/ROX-Filer/src/support.c b/ROX-Filer/src/support.c index 291dea97..9a93f6db 100644 --- a/ROX-Filer/src/support.c +++ b/ROX-Filer/src/support.c @@ -270,8 +270,7 @@ char *format_size(off_t size) else units = _("bytes"); - if (buffer) - g_free(buffer); + g_free(buffer); buffer = g_strdup_printf("%" SIZE_FMT " %s", size, units); return buffer; @@ -308,9 +307,7 @@ char *format_size_aligned(off_t size) else units = ' '; - if (buffer) - g_free(buffer); - + g_free(buffer); buffer = g_strdup_printf("%4" SIZE_FMT "%c", size, units); return buffer; @@ -352,8 +349,7 @@ gchar *format_double_size(double size) else units = _("byte"); - if (buf) - g_free(buf); + g_free(buf); buf = g_strdup_printf("%.0f %s", floor(size), units); return buf; @@ -385,10 +381,7 @@ char *fork_exec_wait(const char **argv) } if (errors && !*errors) - { - g_free(errors); - errors = NULL; - } + null_g_free(&errors); if (!WIFEXITED(status)) { @@ -1107,3 +1100,20 @@ gchar *expand_path(const gchar *path) return retval; } + +/* g_free() every element in the list, then free the list itself and + * NULL the pointer to the list. + */ +void destroy_glist(GList **list) +{ + GList *l = *list; + g_list_foreach(l, (GFunc) g_free, NULL); + g_list_free(l); + *list = NULL; +} + +void null_g_free(gpointer p) +{ + g_free(*(gpointer *)p); + *(gpointer *)p = NULL; +} diff --git a/ROX-Filer/src/support.h b/ROX-Filer/src/support.h index 0857a422..cb9111e9 100644 --- a/ROX-Filer/src/support.h +++ b/ROX-Filer/src/support.h @@ -45,5 +45,7 @@ gchar *to_utf8(const gchar *src); gchar *from_utf8(const gchar *src); char *md5_hash(const char *message); gchar *expand_path(const gchar *path); +void destroy_glist(GList **list); +void null_g_free(gpointer p); #endif /* _SUPPORT_H */ diff --git a/ROX-Filer/src/tasklist.c b/ROX-Filer/src/tasklist.c index 533850ba..40dc7cef 100644 --- a/ROX-Filer/src/tasklist.c +++ b/ROX-Filer/src/tasklist.c @@ -44,6 +44,7 @@ #include "main.h" #include "pinboard.h" #include "pixmaps.h" +#include "support.h" /* There is one of these for each window controlled by the window * manager (all tasks) in the _NET_CLIENT_LIST property. @@ -152,8 +153,7 @@ static void icon_win_free(IconWindow *win) g_return_if_fail(win->widget == NULL); g_return_if_fail(win->label == NULL); - if (win->text) - g_free(win->text); + g_free(win->text); g_free(win); } @@ -252,11 +252,7 @@ static gchar *get_str(IconWindow *win, GdkAtom atom) static void get_icon_name(IconWindow *win) { - if (win->text) - { - g_free(win->text); - win->text = NULL; - } + null_g_free(&win->text); win->text = get_str(win, xa__NET_WM_ICON_NAME); if (!win->text) diff --git a/ROX-Filer/src/type.c b/ROX-Filer/src/type.c index f78a09ff..88c1a86d 100644 --- a/ROX-Filer/src/type.c +++ b/ROX-Filer/src/type.c @@ -600,9 +600,9 @@ static void drag_app_dropped(GtkWidget *eb, g_strerror(errno)); else destroy_on_idle(dialog); - } - g_free(path); + g_free(path); + } } else delayed_error( @@ -909,8 +909,7 @@ char *get_action_save_path(GtkWidget *dialog) "delete it?"), 2, _("Cancel"), _("Delete")) != 1) { - g_free(path); - path = NULL; + null_g_free(&path); goto out; } } @@ -919,8 +918,7 @@ char *get_action_save_path(GtkWidget *dialog) { report_error(_("Can't remove %s: %s"), path, g_strerror(errno)); - g_free(path); - path = NULL; + null_g_free(&path); goto out; } } @@ -1117,7 +1115,7 @@ static void import_file(const gchar *file, GHashTable *globs) if (!g_file_get_contents(file, &data, NULL, &error)) { - delayed_error("Error loading MIME database:\n%s", + delayed_error(_("Error loading MIME database:\n%s"), error->message); g_error_free(error); return; diff --git a/ROX-Filer/src/usericons.c b/ROX-Filer/src/usericons.c index c66b3ac2..5ec521b4 100644 --- a/ROX-Filer/src/usericons.c +++ b/ROX-Filer/src/usericons.c @@ -561,7 +561,7 @@ static void drag_icon_dropped(GtkWidget *frame, guint32 time, GtkWidget *dialog) { - GList *uris, *next; + GList *uris; guchar *icon = NULL; if (!selection_data->data) @@ -572,9 +572,7 @@ static void drag_icon_dropped(GtkWidget *frame, if (g_list_length(uris) == 1) icon = g_strdup(get_local_path((guchar *) uris->data)); - for (next = uris; next; next = next->next) - g_free(next->data); - g_list_free(uris); + destroy_glist(&uris); if (!icon) { -- 2.11.4.GIT