From: Sami Kerola Date: Sun, 4 Sep 2016 20:04:02 +0000 (+0100) Subject: performance: set few variables read-only X-Git-Tag: v0.88~26^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68159b381136d0c03b995eb8975c164448118957;p=thirdparty%2Fmtr.git performance: set few variables read-only --- diff --git a/mtr.c b/mtr.c index 534e8ac..250c9fa 100644 --- 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 */ {' ', ": 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 44814fe..587bd68 100644 --- 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 {