]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
performance: set few variables read-only
authorSami Kerola <kerolasa@iki.fi>
Sun, 4 Sep 2016 20:04:02 +0000 (21:04 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sun, 4 Sep 2016 20:13:41 +0000 (21:13 +0100)
mtr.c
net.h

diff --git a/mtr.c b/mtr.c
index 534e8ac351a09f1199dbff04ddb2daee66d10065..250c9fa121187f53753ac8c12954f7be74cab6d9 100644 (file)
--- a/mtr.c
+++ b/mtr.c
@@ -66,7 +66,7 @@
 #endif
 
 
-struct fields data_fields[MAXFLD] = {
+const struct fields data_fields[MAXFLD] = {
   /* key, Remark, Header, Format, Width, CallBackFunc */
   {' ', "<sp>: Space between fields", " ",  " ",        1, &net_drop  },
   {'L', "L: Loss Ratio",          "Loss%",  " %4.1f%%", 6, &net_loss  },
@@ -271,7 +271,7 @@ static void parse_arg (struct mtr_ctl *ctl, int argc, char **argv)
   enum {
     OPT_DISPLAYMODE = CHAR_MAX + 1
   };
-  static struct option long_options[] = {
+  static const struct option long_options[] = {
     /* option name, has argument, NULL, short name */
     { "help",           0, NULL, 'h' },
     { "version",        0, NULL, 'v' },
diff --git a/net.h b/net.h
index 44814fe5838af534c764c1b7bf776593956d512b..587bd680fbda73db8c9a0d187a926eae8c8647c1 100644 (file)
--- a/net.h
+++ b/net.h
@@ -113,7 +113,7 @@ struct fields {
   int (*net_xxx)(int);
 };
 
-extern struct fields data_fields[MAXFLD];
+extern const struct fields data_fields[MAXFLD];
 
 /* MPLS label object */
 struct mplslen {