Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5002)
static LHASH_OF(FUNCTION) *prog_init(void)
{
static LHASH_OF(FUNCTION) *prog_init(void)
{
- LHASH_OF(FUNCTION) *ret;
+ static LHASH_OF(FUNCTION) *ret = NULL;
+ static int prog_inited = 0;
+ if (prog_inited)
+ return ret;
+
+ prog_inited = 1;
+
/* Sort alphabetically within category. For nicer help displays. */
/* Sort alphabetically within category. For nicer help displays. */
- for (i = 0, f = functions; f->name != NULL; ++f, ++i) ;
+ for (i = 0, f = functions; f->name != NULL; ++f, ++i)
+ ;
qsort(functions, i, sizeof(*functions), SortFnByName);
if ((ret = lh_FUNCTION_new(function_hash, function_cmp)) == NULL)
qsort(functions, i, sizeof(*functions), SortFnByName);
if ((ret = lh_FUNCTION_new(function_hash, function_cmp)) == NULL)