aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-12-24 15:51:23 +0000
committerDr. Stephen Henson <steve@openssl.org>2016-01-11 17:50:27 +0000
commit62d0577e0d5e3703436d0fba362d516481291810 (patch)
tree5298b79f976f3264b244acba116fcdfbc8172a93 /include
parente6b5c341b94d357b0158ad74b12edd51399a4b87 (diff)
downloadopenssl-62d0577e0d5e3703436d0fba362d516481291810.tar.gz
Add lh_new() inlining
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'include')
-rw-r--r--include/openssl/lhash.h9
-rw-r--r--include/openssl/safestack.h12
2 files changed, 7 insertions, 14 deletions
diff --git a/include/openssl/lhash.h b/include/openssl/lhash.h
index d5097cddd6..057c831dd8 100644
--- a/include/openssl/lhash.h
+++ b/include/openssl/lhash.h
@@ -195,6 +195,13 @@ void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out);
# define DECLARE_LHASH_OF(type) \
LHASH_OF(type) { int dummy; }; \
+ static inline LHASH_OF(type) * \
+ lh_##type##_new(unsigned long (*hfn)(const type *), \
+ int (*cfn)(const type *, const type *)) \
+ { \
+ return (LHASH_OF(type) *) \
+ lh_new((LHASH_HASH_FN_TYPE) hfn, (LHASH_COMP_FN_TYPE)cfn); \
+ } \
static inline void lh_##type##_free(LHASH_OF(type) *lh) \
{ \
lh_free((_LHASH *)lh); \
@@ -245,8 +252,6 @@ void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out);
((_LHASH *)CHECKED_PTR_OF(LHASH_OF(type),lh))
/* Define wrapper functions. */
-# define LHM_lh_new(type, name) \
- ((LHASH_OF(type) *)lh_new(LHASH_HASH_FN(name), LHASH_COMP_FN(name)))
# define LHM_lh_doall(type, lh,fn) lh_doall(CHECKED_LHASH_OF(type, lh), fn)
# define LHM_lh_doall_arg(type, lh, fn, arg_type, arg) \
lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg))
diff --git a/include/openssl/safestack.h b/include/openssl/safestack.h
index 5fc1a449a9..43493fc1e0 100644
--- a/include/openssl/safestack.h
+++ b/include/openssl/safestack.h
@@ -231,62 +231,50 @@ DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
*/
-# define lh_ADDED_OBJ_new() LHM_lh_new(ADDED_OBJ,added_obj)
# define lh_ADDED_OBJ_doall(lh,fn) LHM_lh_doall(ADDED_OBJ,lh,fn)
# define lh_ADDED_OBJ_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(ADDED_OBJ,lh,fn,arg_type,arg)
-# define lh_APP_INFO_new() LHM_lh_new(APP_INFO,app_info)
# define lh_APP_INFO_doall(lh,fn) LHM_lh_doall(APP_INFO,lh,fn)
# define lh_APP_INFO_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(APP_INFO,lh,fn,arg_type,arg)
-# define lh_CONF_VALUE_new() LHM_lh_new(CONF_VALUE,conf_value)
# define lh_CONF_VALUE_doall(lh,fn) LHM_lh_doall(CONF_VALUE,lh,fn)
# define lh_CONF_VALUE_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(CONF_VALUE,lh,fn,arg_type,arg)
-# define lh_ENGINE_PILE_new() LHM_lh_new(ENGINE_PILE,engine_pile)
# define lh_ENGINE_PILE_doall(lh,fn) LHM_lh_doall(ENGINE_PILE,lh,fn)
# define lh_ENGINE_PILE_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(ENGINE_PILE,lh,fn,arg_type,arg)
-# define lh_ERR_STATE_new() LHM_lh_new(ERR_STATE,err_state)
# define lh_ERR_STATE_doall(lh,fn) LHM_lh_doall(ERR_STATE,lh,fn)
# define lh_ERR_STATE_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(ERR_STATE,lh,fn,arg_type,arg)
-# define lh_ERR_STRING_DATA_new() LHM_lh_new(ERR_STRING_DATA,err_string_data)
# define lh_ERR_STRING_DATA_doall(lh,fn) LHM_lh_doall(ERR_STRING_DATA,lh,fn)
# define lh_ERR_STRING_DATA_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(ERR_STRING_DATA,lh,fn,arg_type,arg)
-# define lh_FUNCTION_new() LHM_lh_new(FUNCTION,function)
# define lh_FUNCTION_doall(lh,fn) LHM_lh_doall(FUNCTION,lh,fn)
# define lh_FUNCTION_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(FUNCTION,lh,fn,arg_type,arg)
-# define lh_MEM_new() LHM_lh_new(MEM,mem)
# define lh_MEM_doall(lh,fn) LHM_lh_doall(MEM,lh,fn)
# define lh_MEM_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(MEM,lh,fn,arg_type,arg)
-# define lh_OBJ_NAME_new() LHM_lh_new(OBJ_NAME,obj_name)
# define lh_OBJ_NAME_doall(lh,fn) LHM_lh_doall(OBJ_NAME,lh,fn)
# define lh_OBJ_NAME_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(OBJ_NAME,lh,fn,arg_type,arg)
-# define lh_OPENSSL_CSTRING_new() LHM_lh_new(OPENSSL_CSTRING,openssl_cstring)
# define lh_OPENSSL_CSTRING_doall(lh,fn) LHM_lh_doall(OPENSSL_CSTRING,lh,fn)
# define lh_OPENSSL_CSTRING_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(OPENSSL_CSTRING,lh,fn,arg_type,arg)
-# define lh_OPENSSL_STRING_new() LHM_lh_new(OPENSSL_STRING,openssl_string)
# define lh_OPENSSL_STRING_doall(lh,fn) LHM_lh_doall(OPENSSL_STRING,lh,fn)
# define lh_OPENSSL_STRING_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(OPENSSL_STRING,lh,fn,arg_type,arg)
-# define lh_SSL_SESSION_new() LHM_lh_new(SSL_SESSION,ssl_session)
# define lh_SSL_SESSION_doall(lh,fn) LHM_lh_doall(SSL_SESSION,lh,fn)
# define lh_SSL_SESSION_doall_arg(lh,fn,arg_type,arg) \
LHM_lh_doall_arg(SSL_SESSION,lh,fn,arg_type,arg)