From e6b5c341b94d357b0158ad74b12edd51399a4b87 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 11 Jan 2016 14:11:13 +0000 Subject: Inline LHASH_OF Make LHASH_OF use static inline functions. Add new lh_get_down_load and lh_set_down_load functions and their typesafe inline equivalents. Make lh_error a function instead of a macro. Reviewed-by: Rich Salz --- crypto/objects/Makefile | 4 ++-- crypto/objects/o_names.c | 9 ++++----- crypto/objects/o_names.h | 4 ---- crypto/objects/obj_dat.c | 8 ++++---- crypto/objects/obj_lcl.h | 7 +++++++ 5 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 crypto/objects/o_names.h create mode 100644 crypto/objects/obj_lcl.h (limited to 'crypto/objects') diff --git a/crypto/objects/Makefile b/crypto/objects/Makefile index f413b0f472..0cfaf5a85b 100644 --- a/crypto/objects/Makefile +++ b/crypto/objects/Makefile @@ -21,7 +21,7 @@ LIBOBJ= o_names.o obj_dat.o obj_lib.o obj_err.o obj_xref.o SRC= $(LIBSRC) -HEADER= obj_dat.h obj_xref.h o_names.h +HEADER= obj_dat.h obj_xref.h obj_lcl.h ALL= $(GENERAL) $(SRC) $(HEADER) @@ -80,7 +80,7 @@ o_names.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h o_names.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h o_names.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h o_names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h -o_names.o: o_names.c o_names.h +o_names.o: o_names.c obj_lcl.h obj_dat.o: ../../e_os.h ../../include/openssl/asn1.h obj_dat.o: ../../include/openssl/bio.h ../../include/openssl/bn.h obj_dat.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index 476c3770f8..df6240bfd0 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -7,7 +7,7 @@ #include #include #include -#include "o_names.h" +#include "obj_lcl.h" /* * Later versions of DEC C has started to add lnkage information to certain @@ -25,7 +25,6 @@ * I use the ex_data stuff to manage the identifiers for the obj_name_types * that applications may define. I only really use the free function field. */ -DECLARE_LHASH_OF(OBJ_NAME); static LHASH_OF(OBJ_NAME) *names_lh = NULL; static int names_type_num = OBJ_NAME_TYPE_NUM; @@ -346,8 +345,8 @@ void OBJ_NAME_cleanup(int type) return; free_type = type; - down_load = lh_OBJ_NAME_down_load(names_lh); - lh_OBJ_NAME_down_load(names_lh) = 0; + down_load = lh_OBJ_NAME_get_down_load(names_lh); + lh_OBJ_NAME_set_down_load(names_lh, 0); lh_OBJ_NAME_doall(names_lh, LHASH_DOALL_FN(names_lh_free)); if (type < 0) { @@ -356,5 +355,5 @@ void OBJ_NAME_cleanup(int type) names_lh = NULL; name_funcs_stack = NULL; } else - lh_OBJ_NAME_down_load(names_lh) = down_load; + lh_OBJ_NAME_set_down_load(names_lh, down_load); } diff --git a/crypto/objects/o_names.h b/crypto/objects/o_names.h deleted file mode 100644 index 914ed33086..0000000000 --- a/crypto/objects/o_names.h +++ /dev/null @@ -1,4 +0,0 @@ - - -typedef struct name_funcs_st NAME_FUNCS; -DEFINE_STACK_OF(NAME_FUNCS) diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index bda955651e..51a44a285f 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -65,6 +65,7 @@ #include #include #include "internal/asn1_int.h" +#include "obj_lcl.h" /* obj_dat.h is generated from objects.h by obj_dat.pl */ #include "obj_dat.h" @@ -78,11 +79,10 @@ DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); #define ADDED_LNAME 2 #define ADDED_NID 3 -typedef struct added_obj_st { +struct added_obj_st { int type; ASN1_OBJECT *obj; -} ADDED_OBJ; -DECLARE_LHASH_OF(ADDED_OBJ); +}; static int new_nid = NUM_NID; static LHASH_OF(ADDED_OBJ) *added = NULL; @@ -227,7 +227,7 @@ void OBJ_cleanup(void) } if (added == NULL) return; - lh_ADDED_OBJ_down_load(added) = 0; + lh_ADDED_OBJ_set_down_load(added, 0); lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup1)); /* zero counters */ lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup2)); /* set counters */ lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup3)); /* free objects */ diff --git a/crypto/objects/obj_lcl.h b/crypto/objects/obj_lcl.h new file mode 100644 index 0000000000..6a8f75f09e --- /dev/null +++ b/crypto/objects/obj_lcl.h @@ -0,0 +1,7 @@ + + +typedef struct name_funcs_st NAME_FUNCS; +DEFINE_STACK_OF(NAME_FUNCS) +DECLARE_LHASH_OF(OBJ_NAME); +typedef struct added_obj_st ADDED_OBJ; +DECLARE_LHASH_OF(ADDED_OBJ); -- cgit v1.2.3