Commit 3e8e688f authored by Rich Salz's avatar Rich Salz Committed by Rich Salz
Browse files

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: default avatarRichard Levitte <levitte@openssl.org>
parent ac38115c
Loading
Loading
Loading
Loading
+7 −2
Changes for apps/apps.h: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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)
+164 −384

File changed.

Preview size limit exceeded, changes collapsed.