Source: nn Version: 6.7.3-14 Severity: normal Tags: patch Dear Maintainer,
>From d66640fce092fd7cded61a4243e3ba2fa07abfbe Mon Sep 17 00:00:00 2001 >From: Bjarni Ingi Gislason <[email protected]> >Date: Tue, 9 Mar 2021 00:43:16 +0000 >Subject: [PATCH] Some files: define a macro NDELAYED_MSG and use it for the > size of the array "delayed_msg[]! global.h: define NDELAYED_MSG as the size of the array delayed_msg[]. 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 <[email protected]> --- 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; -extern const size_t ndelayed_msg; +/* NDELAYED_MSG defined in "global.h"; size of array delayed_msg[] */ extern char delayed_msg[]; extern int32 db_read_counter; @@ -1164,7 +1164,7 @@ merge_and_read(flag_type access_mode, char *mask) current_group = &dummy_group; kb = (kb + 1023) >> 10; - snprintf(delayed_msg, ndelayed_msg, "Read %ld articles in %ld seconds (%ld kbyte/s)", + snprintf(delayed_msg, NDELAYED_MSG, "Read %ld articles in %ld seconds (%ld kbyte/s)", (long) db_read_counter, (long) t2, t2 > 0 ? kb / t2 : kb); menu(merged_header); diff --git a/menu.c b/menu.c index 90462c4..0e827e0 100644 --- a/menu.c +++ b/menu.c @@ -95,7 +95,7 @@ int auto_select_subject = 0; /* auto select articles with int auto_read_limit = 0; /* ignore auto_read_mode if less * articles */ -extern const size_t NDELAYED_MSG; +/* NDELAYED_MSG defined in global.h; size of array delayed_msg */ extern char delayed_msg[]; /* give to msg() after redraw */ int flush_typeahead = 0; diff --git a/more.c b/more.c index 843ead0..ab1bbc0 100644 --- a/more.c +++ b/more.c @@ -74,7 +74,6 @@ extern int mouse_state; extern int alt_cmd_key, in_menu_mode, any_message; extern long n_selected; -extern const size_t ndelayed_msg; /* size of array "delayed_msg[]" */ extern char delayed_msg[]; static int rot13_must_init = 1; -- 2.30.1 -- System Information: Debian Release: bullseye/sid APT prefers testing APT policy: (500, 'testing'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 5.10.9-1 (SMP w/2 CPU threads) Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init) -- debconf information excluded -- Bjarni I. Gislason

