aboutsummaryrefslogtreecommitdiffstats
path: root/apps/apps.h
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-05-15 16:32:49 -0400
committerRich Salz <rsalz@openssl.org>2015-05-20 17:51:52 -0400
commit3e8e688f867a1ec1e554da67f111fa58a6ee1138 (patch)
tree5d7d7d54e9cc66b0f27c5aef2eec802e55203088 /apps/apps.h
parentac38115c1a4fb61c66c2a8cd2a9800751828d328 (diff)
downloadopenssl-3e8e688f867a1ec1e554da67f111fa58a6ee1138.tar.gz
Replace switch/assignments with table lookup
Typedef STRINT_PAIR to be the same as OPT_PAIR, and use that structure and a bunch of tables instead of switch statements to lookup various values out of the SSL/TLS message buffers. Shrinks a bunch of code. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/apps.h')
-rw-r--r--apps/apps.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/apps.h b/apps/apps.h
index e55dcd60e8..7033d2e5c6 100644
--- a/apps/apps.h
+++ b/apps/apps.h
@@ -340,10 +340,15 @@ typedef struct options_st {
const char *helpstr;
} OPTIONS;
-typedef struct opt_pair_st {
+/*
+ * A string/int pairing; widely use for option value lookup, hence the
+ * name OPT_PAIR. But that name is misleading in s_cb.c, so we also use
+ * the "generic" name STRINT_PAIR.
+ */
+typedef struct string_int_pair_st {
const char *name;
int retval;
-} OPT_PAIR;
+} OPT_PAIR, STRINT_PAIR;
/* Flags to pass into opt_format; see FORMAT_xxx, below. */
# define OPT_FMT_PEMDER (1L << 1)