[openssl-commits] [openssl] master update

Dr. Stephen Henson steve at openssl.org
Sat May 21 21:50:07 UTC 2016


The branch master has been updated
       via  4591e5fb4168eb81d198a236d265d87256bf67c1 (commit)
      from  8bf780432c11bcedf20161f5e76bc19e300af419 (commit)


- Log -----------------------------------------------------------------
commit 4591e5fb4168eb81d198a236d265d87256bf67c1
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Sat May 21 16:31:09 2016 +0100

    Constify stack and lhash macros.
    
    RT#4471
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>

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

Summary of changes:
 crypto/stack/stack.c        | 13 +++++++------
 include/openssl/lhash.h     |  6 +++---
 include/openssl/safestack.h |  7 ++++---
 include/openssl/stack.h     |  6 +++---
 4 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c
index 36fc921..0076db1 100644
--- a/crypto/stack/stack.c
+++ b/crypto/stack/stack.c
@@ -142,14 +142,14 @@ int OPENSSL_sk_insert(OPENSSL_STACK *st, void *data, int loc)
     return (st->num);
 }
 
-void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, void *p)
+void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p)
 {
     int i;
 
     for (i = 0; i < st->num; i++)
         if (st->data[i] == p)
-            return (OPENSSL_sk_delete(st, i));
-    return (NULL);
+            return OPENSSL_sk_delete(st, i);
+    return NULL;
 }
 
 void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc)
@@ -174,7 +174,8 @@ void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc)
     return (ret);
 }
 
-static int internal_find(OPENSSL_STACK *st, void *data, int ret_val_options)
+static int internal_find(OPENSSL_STACK *st, const void *data,
+                         int ret_val_options)
 {
     const void *const *r;
     int i;
@@ -198,12 +199,12 @@ static int internal_find(OPENSSL_STACK *st, void *data, int ret_val_options)
     return (int)((char **)r - st->data);
 }
 
-int OPENSSL_sk_find(OPENSSL_STACK *st, void *data)
+int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)
 {
     return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
 }
 
-int OPENSSL_sk_find_ex(OPENSSL_STACK *st, void *data)
+int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data)
 {
     return internal_find(st, data, OBJ_BSEARCH_VALUE_ON_NOMATCH);
 }
diff --git a/include/openssl/lhash.h b/include/openssl/lhash.h
index 7c568ac..e2ccb65 100644
--- a/include/openssl/lhash.h
+++ b/include/openssl/lhash.h
@@ -153,15 +153,15 @@ void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out);
     } \
     static ossl_inline void lh_##type##_node_stats_bio(const LHASH_OF(type) *lh, BIO *out) \
     { \
-        OPENSSL_LH_node_stats_bio((OPENSSL_LHASH *)lh, out); \
+        OPENSSL_LH_node_stats_bio((const OPENSSL_LHASH *)lh, out); \
     } \
     static ossl_inline void lh_##type##_node_usage_stats_bio(const LHASH_OF(type) *lh, BIO *out) \
     { \
-        OPENSSL_LH_node_usage_stats_bio((OPENSSL_LHASH *)lh, out); \
+        OPENSSL_LH_node_usage_stats_bio((const OPENSSL_LHASH *)lh, out); \
     } \
     static ossl_inline void lh_##type##_stats_bio(const LHASH_OF(type) *lh, BIO *out) \
     { \
-        OPENSSL_LH_stats_bio((OPENSSL_LHASH *)lh, out); \
+        OPENSSL_LH_stats_bio((const OPENSSL_LHASH *)lh, out); \
     } \
     static ossl_inline unsigned long lh_##type##_get_down_load(LHASH_OF(type) *lh) \
     { \
diff --git a/include/openssl/safestack.h b/include/openssl/safestack.h
index d0af0eb..306b3ac 100644
--- a/include/openssl/safestack.h
+++ b/include/openssl/safestack.h
@@ -54,7 +54,8 @@ extern "C" {
     } \
     static ossl_inline t2 *sk_##t1##_delete_ptr(STACK_OF(t1) *sk, t2 *ptr) \
     { \
-        return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk, (void *)ptr); \
+        return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk, \
+                                           (const void *)ptr); \
     } \
     static ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr) \
     { \
@@ -86,11 +87,11 @@ extern "C" {
     } \
     static ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr) \
     { \
-        return OPENSSL_sk_find((OPENSSL_STACK *)sk, (void *)ptr); \
+        return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \
     } \
     static ossl_inline int sk_##t1##_find_ex(STACK_OF(t1) *sk, t2 *ptr) \
     { \
-        return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (void *)ptr); \
+        return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (const void *)ptr); \
     } \
     static ossl_inline void sk_##t1##_sort(STACK_OF(t1) *sk) \
     { \
diff --git a/include/openssl/stack.h b/include/openssl/stack.h
index 6fab33b..9bc550f 100644
--- a/include/openssl/stack.h
+++ b/include/openssl/stack.h
@@ -32,9 +32,9 @@ void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void (*func) (void *));
 OPENSSL_STACK *OPENSSL_sk_deep_copy(OPENSSL_STACK *, OPENSSL_sk_copyfunc c, OPENSSL_sk_freefunc f);
 int OPENSSL_sk_insert(OPENSSL_STACK *sk, void *data, int where);
 void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc);
-void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, void *p);
-int OPENSSL_sk_find(OPENSSL_STACK *st, void *data);
-int OPENSSL_sk_find_ex(OPENSSL_STACK *st, void *data);
+void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p);
+int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data);
+int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data);
 int OPENSSL_sk_push(OPENSSL_STACK *st, void *data);
 int OPENSSL_sk_unshift(OPENSSL_STACK *st, void *data);
 void *OPENSSL_sk_shift(OPENSSL_STACK *st);


More information about the openssl-commits mailing list