#984840 Some files: define a macro NDELAYED_MSG and use it for the size of the array "delayed_msg[]!

Package:
src:nn
Source:
nn
Submitter:
Bjarni Ingi Gislason
Date:
2021-03-09 00:57:05 UTC
Severity:
normal
Tags:
#984840#5
Date:
2021-03-09 00:55:42 UTC
From:
To:
Dear Maintainer,

  aux.c: use NDELAYED_MSG for the size of the array "delayed_msg[],
and use it instead of the variable "ndelayed_msg".

  group.c: likewise

  menu.c: likewise

  more.c: likewise

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 aux.c    | 14 +++++++-------
 global.h |  7 +++++++
 group.c  |  4 ++--
 menu.c   |  2 +-
 more.c   |  1 -
 5 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/aux.c b/aux.c
index 9326195..47f1561 100644
--- a/aux.c
+++ b/aux.c
@@ -25,8 +25,8 @@
 extern char    *temp_file;

 extern int      novice;
-const size_t    ndelayed_msg = 100; /* size of array "delayed_msg[]" */
-char            delayed_msg[ndelayed_msg];
+/* NDELAYED_MSG defined in "global.h" */
+char            delayed_msg[NDELAYED_MSG];
 extern char    *pager;
 extern char    *inews_program;
 extern int      inews_pipe_input;
@@ -177,10 +177,10 @@ no_params:
     *ap++ = NULL;

     if (execute(SHELL, args, 1)) {
-	snprintf(delayed_msg, ndelayed_msg, sent_fmt, " not");
+	snprintf(delayed_msg, NDELAYED_MSG, sent_fmt, " not");
 	return 1;
     }
-    snprintf(delayed_msg, ndelayed_msg, sent_fmt, "");
+    snprintf(delayed_msg, NDELAYED_MSG, sent_fmt, "");
     return 0;
 }

@@ -461,14 +461,14 @@ aux_sh(article_header * ah, char *script, char *prog, char *action, char *record
 		nn_raw();

 		if (stat(temp_file, &statb) < 0 || statb.st_size == 0) {
-		    snprintf(delayed_msg, ndelayed_msg, sent_fmt, " not");
+		    snprintf(delayed_msg, NDELAYED_MSG, sent_fmt, " not");
 		    unlink(temp_file);
 		    unlink(copy);
 		    return (22);
 		}
 		if (empty_answer_check) {
 		    if (cmp_file(temp_file, copy) != 1) {
-			snprintf(delayed_msg, ndelayed_msg, sent_fmt, " not");
+			snprintf(delayed_msg, NDELAYED_MSG, sent_fmt, " not");
 			unlink(temp_file);
 			unlink(copy);
 			return (22);
@@ -722,7 +722,7 @@ aux.c:...: warning: the address of 'fname' will always evaluate as 'true'
     unlink(temp_file);
     unlink(copy);
     unlink(final);
-    snprintf(delayed_msg, ndelayed_msg, sent_fmt, "");
+    snprintf(delayed_msg, NDELAYED_MSG, sent_fmt, "");
     return (0);
 }

diff --git a/global.h b/global.h
index 9f75975..6a65c63 100644
--- a/global.h
+++ b/global.h
@@ -10,6 +10,13 @@

 #include <stdio.h>

+/*
+ * Constants for the size of arrays, that are used in more than on file
+ */
+
+/* Array delayed_msg[] */
+#define NDELAYED_MST 100
+
 /*
  *	Various constants and types
  */
diff --git a/group.c b/group.c
index 44fd67f..aa533c4 100644
--- a/group.c
+++ b/group.c
@@ -53,7 +53,7 @@ extern int      killed_articles;
 extern int      seq_cross_filtering;
 extern char    *default_save_file, *folder_save_file;