Add lh_new() inlining
[openssl.git] / crypto / conf / conf_api.c
index 59808a301b6ff6a1a7b9ac1414c3e6d75391e04d..408e49725c5bcc14d3ad4554459d11abb2e1213f 100644 (file)
@@ -162,8 +162,6 @@ static unsigned long conf_value_hash(const CONF_VALUE *v)
     return (lh_strhash(v->section) << 2) ^ lh_strhash(v->name);
 }
 
-static IMPLEMENT_LHASH_HASH_FN(conf_value, CONF_VALUE)
-
 static int conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b)
 {
     int i;
@@ -183,17 +181,16 @@ static int conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b)
         return ((a->name == NULL) ? -1 : 1);
 }
 
-static IMPLEMENT_LHASH_COMP_FN(conf_value, CONF_VALUE)
-
 int _CONF_new_data(CONF *conf)
 {
     if (conf == NULL) {
         return 0;
     }
-    if (conf->data == NULL)
-        if ((conf->data = lh_CONF_VALUE_new()) == NULL) {
+    if (conf->data == NULL) {
+        conf->data = lh_CONF_VALUE_new(conf_value_hash, conf_value_cmp);
+        if (conf->data == NULL)
             return 0;
-        }
+    }
     return 1;
 }
 
@@ -202,9 +199,8 @@ void _CONF_free_data(CONF *conf)
     if (conf == NULL || conf->data == NULL)
         return;
 
-    lh_CONF_VALUE_down_load(conf->data) = 0; /* evil thing to make * sure the
-                                              * 'OPENSSL_free()' works as *
-                                              * expected */
+    /* evil thing to make sure the 'OPENSSL_free()' works as expected */
+    lh_CONF_VALUE_set_down_load(conf->data, 0);
     lh_CONF_VALUE_doall_arg(conf->data,
                             LHASH_DOALL_ARG_FN(value_free_hash),
                             LHASH_OF(CONF_VALUE), conf->data);
@@ -255,7 +251,7 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section)
 
     if ((sk = sk_CONF_VALUE_new_null()) == NULL)
         goto err;
-    if ((v = OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL)
+    if ((v = OPENSSL_malloc(sizeof(*v))) == NULL)
         goto err;
     i = strlen(section) + 1;
     if ((v->section = OPENSSL_malloc(i)) == NULL)