From 2a281ad18ddaa79cee446d3ba5bf1c1b09654aaa Mon Sep 17 00:00:00 2001 From: Roland Illig Date: Mon, 7 Feb 2005 20:08:01 +0000 Subject: [PATCH] * *.c: Removed unused parameters for static functions. Marked unused parameters for global functions. Removed redundant comments. --- edit/ChangeLog | 3 +++ edit/bookmark.c | 2 ++ edit/editcmd.c | 13 +------------ edit/editlock.c | 13 +++++++------ edit/syntax.c | 2 ++ edit/wordproc.c | 18 ++++++++++-------- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/edit/ChangeLog b/edit/ChangeLog index baa6b172e..b0f25ddb6 100644 --- a/edit/ChangeLog +++ b/edit/ChangeLog @@ -1,6 +1,9 @@ 2005-02-07 Roland Illig * *.c: Removed trailing whitespace. + * *.c: Removed unused parameters for static functions. Marked + unused parameters for global functions. Removed redundant + comments. 2005-02-07 Roland Illig diff --git a/edit/bookmark.c b/edit/bookmark.c index 4256b5d0d..346bc1166 100644 --- a/edit/bookmark.c +++ b/edit/bookmark.c @@ -32,6 +32,8 @@ static inline struct _book_mark *double_marks (WEdit * edit, struct _book_mark *p) { + (void) edit; + if (p->next) while (p->next->line == p->line) p = p->next; diff --git a/edit/editcmd.c b/edit/editcmd.c index fbbe041f8..b56c6fa0f 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -624,17 +624,13 @@ edit_delete_macro (WEdit * edit, int k) return 0; g = fopen (catstrs (home_dir, TEMP_FILE, (char *) NULL), "w"); if (!g) { -/* This heads the delete macro error dialog box */ edit_error_dialog (_(" Delete macro "), -/* 'Open' = load temp file */ get_sys_error (_(" Cannot open temp file "))); return 1; } f = edit_open_macro_file ("r"); if (!f) { -/* This heads the delete macro error dialog box */ edit_error_dialog (_(" Delete macro "), -/* 'Open' = load temp file */ get_sys_error (_(" Cannot open macro file "))); fclose (g); return 1; @@ -657,7 +653,6 @@ edit_delete_macro (WEdit * edit, int k) fclose (f); fclose (g); if (rename (catstrs (home_dir, TEMP_FILE, (char *) NULL), catstrs (home_dir, MACRO_FILE, (char *) NULL)) == -1) { -/* This heads the delete macro error dialog box */ edit_error_dialog (_(" Delete macro "), get_sys_error (_(" Cannot overwrite macro file "))); return 1; @@ -674,10 +669,8 @@ int edit_save_macro_cmd (WEdit * edit, struct macro macro[], int n) int s, i; edit_push_action (edit, KEY_PRESS + edit->start_display); -/* This heads the 'Macro' dialog box */ s = edit_raw_key_query (_(" Save macro "), -/* Input line for a single key press follows the ':' */ - _(" Press the macro's new hotkey: "), 1); + _(" Press the macro's new hotkey: "), 1); edit->force |= REDRAW_COMPLETELY; if (s) { if (edit_delete_macro (edit, s)) @@ -695,7 +688,6 @@ int edit_save_macro_cmd (WEdit * edit, struct macro macro[], int n) } return 1; } else -/* This heads the 'Save Macro' dialog box */ edit_error_dialog (_(" Save macro "), get_sys_error (_(" Cannot open macro file "))); } return 0; @@ -751,7 +743,6 @@ int edit_load_macro_cmd (WEdit * edit, struct macro macro[], int *n, int k) fclose (f); return found; } else -/* This heads the 'Load Macro' dialog box */ edit_error_dialog (_(" Load macro "), get_sys_error (_(" Cannot open macro file "))); return 0; @@ -766,7 +757,6 @@ int edit_save_confirm_cmd (WEdit * edit) if (edit_confirm_save) { f = catstrs (_(" Confirm save file? : "), edit->filename, " ", (char *) NULL); -/* Buttons to 'Confirm save file' query */ if (edit_query_dialog2 (_(" Save file "), f, _("&Save"), _("&Cancel"))) return 0; } @@ -1743,7 +1733,6 @@ err: static void regexp_error (WEdit *edit) { -/* "Error: Syntax error in regular expression, or scanf expression contained too many %'s */ edit_error_dialog (_("Error"), _(" Invalid regular expression, or scanf expression with too many conversions ")); } diff --git a/edit/editlock.c b/edit/editlock.c index 48f84533f..e303cb065 100644 --- a/edit/editlock.c +++ b/edit/editlock.c @@ -50,15 +50,16 @@ struct lock_s { /* Build user@host.domain.pid string (need to be freed) */ static char * -lock_build_name (const char *fname) +lock_build_name (void) { char host[BUF_SIZE]; const char *user; - if (! - ((user = getpwuid (getuid ())->pw_name) || (user = getenv ("USER")) - || (user = getenv ("USERNAME")) || (user = getenv ("LOGNAME")))) - user = ""; + user = getpwuid (getuid ())->pw_name; + if (!user) user = getenv ("USER"); + if (!user) user = getenv ("USERNAME"); + if (!user) user = getenv ("LOGNAME"); + if (!user) user = ""; /* TODO: Use FQDN, no clean interface, so requires lot of code */ if (gethostname (host, BUF_SIZE - 1) == -1) @@ -167,7 +168,7 @@ edit_lock_file (const char *fname) } /* Create lock symlink */ - newlock = lock_build_name (fname); + newlock = lock_build_name (); if (symlink (newlock, lockfname) == -1) { g_free (lockfname); g_free (newlock); diff --git a/edit/syntax.c b/edit/syntax.c index df469ad88..be60d98a2 100644 --- a/edit/syntax.c +++ b/edit/syntax.c @@ -93,6 +93,8 @@ mc_defines_destroy (gpointer key, gpointer value, gpointer data) { char **values = value; + (void) data; + g_free (key); while (*values) g_free (*values++); diff --git a/edit/wordproc.c b/edit/wordproc.c index 9f56f9a23..e0ad7a981 100644 --- a/edit/wordproc.c +++ b/edit/wordproc.c @@ -181,8 +181,8 @@ static int line_pixel_length (unsigned char *t, long b, int l) return b; } -/* find the start of a word */ -static int next_word_start (unsigned char *t, int q, int size) +static int +next_word_start (unsigned char *t, int q) { int i; for (i = q;; i++) { @@ -203,11 +203,12 @@ static int next_word_start (unsigned char *t, int q, int size) } /* find the start of a word */ -static int word_start (unsigned char *t, int q, int size) +static int +word_start (unsigned char *t, int q) { int i = q; if (t[q] == ' ' || t[q] == '\t') - return next_word_start (t, q, size); + return next_word_start (t, q); for (;;) { int c; if (!i) @@ -236,9 +237,9 @@ static void format_this (unsigned char *t, int size, int indent) break; if (t[q] == '\n') break; - p = word_start (t, q, size); + p = word_start (t, q); if (p == -1) - q = next_word_start (t, q, size); /* Return the end of the word if the beginning + q = next_word_start (t, q); /* Return the end of the word if the beginning of the word is at the beginning of a line (i.e. a very long word) */ else @@ -258,7 +259,8 @@ static void replace_at (WEdit * edit, long q, int c) } /* replaces a block of text */ -static void put_paragraph (WEdit * edit, unsigned char *t, long p, long q, int indent, int size) +static void +put_paragraph (WEdit * edit, unsigned char *t, long p, int indent, int size) { long cursor; int i, c = 0; @@ -342,7 +344,7 @@ format_paragraph (WEdit *edit, int force) } } format_this (t, q - p, indent); - put_paragraph (edit, t, p, q, indent, size); + put_paragraph (edit, t, p, indent, size); g_free (t); /* Scroll left as much as possible to show the formatted paragraph */