Commit 9c073fe0 authored by Mike Frysinger's avatar Mike Frysinger

statistics: sort tables statically (and constify)

Rather than do the sorting at runtime, run the tables through `sort`.
This lets us constify them and speed up runtime slightly.
parent 70c3a90b
...@@ -116,9 +116,7 @@ ...@@ -116,9 +116,7 @@
/* prototypes for statistics.c */ /* prototypes for statistics.c */
void parsesnmp(int, int, int); void parsesnmp(int, int, int);
void inittab(void);
void parsesnmp6(int, int, int); void parsesnmp6(int, int, int);
void inittab6(void);
typedef enum { typedef enum {
SS_FREE = 0, /* not allocated */ SS_FREE = 0, /* not allocated */
...@@ -2099,14 +2097,12 @@ int main ...@@ -2099,14 +2097,12 @@ int main
if (!strcmp(afname, "inet")) { if (!strcmp(afname, "inet")) {
#if HAVE_AFINET #if HAVE_AFINET
inittab();
parsesnmp(flag_raw, flag_tcp, flag_udp); parsesnmp(flag_raw, flag_tcp, flag_udp);
#else #else
ENOSUPP("netstat", "AF INET"); ENOSUPP("netstat", "AF INET");
#endif #endif
} else if(!strcmp(afname, "inet6")) { } else if(!strcmp(afname, "inet6")) {
#if HAVE_AFINET6 #if HAVE_AFINET6
inittab6();
parsesnmp6(flag_raw, flag_tcp, flag_udp); parsesnmp6(flag_raw, flag_tcp, flag_udp);
#else #else
ENOSUPP("netstat", "AF INET6"); ENOSUPP("netstat", "AF INET6");
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment