Skip to content

Commit 05c7f89

Browse files
committed
Introduce macro variable for maximal output filename length
Signed-off-by: Christoph Niethammer <[email protected]>
1 parent b823d86 commit 05c7f89

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

tst_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ tst_output_types tst_output_init(tst_output_stream * output, int rank,
7777
va_start(arglist, type);
7878
fname = va_arg (arglist, char *);
7979
sprintf (output->filename,"R%d_", tst_output_global_rank);
80-
freelen = 255 - strlen(output->filename);
80+
freelen = TST_OUTPUT_FILENAME_MAX - (1 + strlen(output->filename));
8181
strncat (output->filename, fname, freelen);
8282
va_end (arglist);
8383
}

tst_output.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ typedef enum {
3333
} tst_report_types;
3434

3535

36+
#define TST_OUTPUT_FILENAME_MAX 256
3637
typedef struct {
3738
FILE * streamptr; /**< Pointer on the stream */
3839
tst_output_types type;
39-
char filename[256]; /**< Filename if stream writes to file */
40+
char filename[TST_OUTPUT_FILENAME_MAX]; /**< Filename if stream writes to file */
4041
tst_report_types level;
4142
int rank; /**< MPI rank responsible for output */
4243
int isopen; /**< open status: 1 if open */

0 commit comments

Comments
 (0)