Skip to contentSkip to conversation

Declare debug_levels[] const

PATCH Applied Bart Van Assche 2 participants 2 messages Mar 10, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Declare debug_levels[] const

Since debug_levels[] is not modified by any code, declare it const.

---
 debug.h | 2 +-
 init.c  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
debug.h +1 -1
index ac5f2ccdd551..b8718ddc225f 100644
@@ -53,7 +53,7 @@ struct debug_level {
 	unsigned long shift;
 	unsigned int jobno;
 };
-extern struct debug_level debug_levels[];
+extern const struct debug_level debug_levels[];
 
 extern unsigned long fio_debug;
 
init.c +3 -3
index 28061db8ea8f..bb0627b208a6 100644
@@ -2094,7 +2094,7 @@ static int fill_def_thread(void)
 static void show_debug_categories(void)
 {
 #ifdef FIO_INC_DEBUG
-	struct debug_level *dl = &debug_levels[0];
+	const struct debug_level *dl = &debug_levels[0];
 	int curlen, first = 1;
 
 	curlen = 0;
@@ -2184,7 +2184,7 @@ static void usage(const char *name)
 }
 
 #ifdef FIO_INC_DEBUG
-struct debug_level debug_levels[] = {
+const struct debug_level debug_levels[] = {
 	{ .name = "process",
 	  .help = "Process creation/exit logging",
 	  .shift = FD_PROCESS,
@@ -2262,7 +2262,7 @@ struct debug_level debug_levels[] = {
 
 static int set_debug(const char *string)
 {
-	struct debug_level *dl;
+	const struct debug_level *dl;
 	char *p = (char *) string;
 	char *opt;
 	int i;
Signature · 1 line
2.16.2
Applied
#1 lore raw
Quoted 1 line · Bart Van Assche

Since debug_levels[] is not modified by any code, declare it const.

Applied, thanks.

Signature · 1 line
Jens Axboe