[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Fri Jul 1 15:00:11 UTC 2016


The branch master has been updated
       via  152d26461609ae36f329d6f48b2d0749e43834f3 (commit)
       via  0a1d3a8152ffb96d42e56c3c1f04eb14a45e66aa (commit)
      from  a66069dbcd020f25b80c66c0e71e137683c54914 (commit)


- Log -----------------------------------------------------------------
commit 152d26461609ae36f329d6f48b2d0749e43834f3
Author: mrpre <mrpre at 163.com>
Date:   Fri Jul 1 08:55:18 2016 +0800

    fix code formatting
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/1223)

commit 0a1d3a8152ffb96d42e56c3c1f04eb14a45e66aa
Author: mrpre <mrpre at 163.com>
Date:   Thu Jun 16 18:00:38 2016 +0800

    add return value for expand
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/1223)

-----------------------------------------------------------------------

Summary of changes:
 crypto/lhash/lhash.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c
index 3e58eea..19c6d2c 100644
--- a/crypto/lhash/lhash.c
+++ b/crypto/lhash/lhash.c
@@ -20,7 +20,7 @@
 #define UP_LOAD         (2*LH_LOAD_MULT) /* load times 256 (default 2) */
 #define DOWN_LOAD       (LH_LOAD_MULT) /* load times 256 (default 1) */
 
-static void expand(OPENSSL_LHASH *lh);
+static int expand(OPENSSL_LHASH *lh);
 static void contract(OPENSSL_LHASH *lh);
 static OPENSSL_LH_NODE **getrn(OPENSSL_LHASH *lh, const void *data, unsigned long *rhash);
 
@@ -74,8 +74,8 @@ void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
     void *ret;
 
     lh->error = 0;
-    if (lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))
-        expand(lh);
+    if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
+        return NULL;        /* 'lh->error++' already done in 'expand' */
 
     rn = getrn(lh, data, &hash);
 
@@ -184,7 +184,7 @@ void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void
     doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
 }
 
-static void expand(OPENSSL_LHASH *lh)
+static int expand(OPENSSL_LHASH *lh)
 {
     OPENSSL_LH_NODE **n, **n1, **n2, *np;
     unsigned int p, i, j;
@@ -216,7 +216,7 @@ static void expand(OPENSSL_LHASH *lh)
             /* fputs("realloc error in lhash",stderr); */
             lh->error++;
             lh->p = 0;
-            return;
+            return 0;
         }
         for (i = (int)lh->num_alloc_nodes; i < j; i++) /* 26/02/92 eay */
             n[i] = NULL;        /* 02/03/92 eay */
@@ -226,6 +226,7 @@ static void expand(OPENSSL_LHASH *lh)
         lh->p = 0;
         lh->b = n;
     }
+    return 1;
 }
 
 static void contract(OPENSSL_LHASH *lh)


More information about the openssl-commits mailing list