提交 3e8e688f 编写于 作者: R Rich Salz 提交者: Rich Salz

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: NRichard Levitte <levitte@openssl.org>
上级 ac38115c
......@@ -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)
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册