Browse Source

* *.c: Removed unused parameters for static functions. Marked
unused parameters for global functions. Removed redundant
comments.

Roland Illig 20 years ago
parent
commit
2a281ad18d
6 changed files with 25 additions and 26 deletions
  1. 3 0
      edit/ChangeLog
  2. 2 0
      edit/bookmark.c
  3. 1 12
      edit/editcmd.c
  4. 7 6
      edit/editlock.c
  5. 2 0
      edit/syntax.c
  6. 10 8
      edit/wordproc.c

+ 3 - 0
edit/ChangeLog

@@ -1,6 +1,9 @@
 2005-02-07  Roland Illig  <roland.illig@gmx.de>
 
 	* *.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  <roland.illig@gmx.de>
 

+ 2 - 0
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;

+ 1 - 12
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 "));
 }
 

+ 7 - 6
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);

+ 2 - 0
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++);

+ 10 - 8
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 */