diff options
author | David Benjamin <davidben@google.com> | 2016-05-13 20:14:28 +0300 |
---|---|---|
committer | David Benjamin <davidben@google.com> | 2016-05-13 21:24:57 +0300 |
commit | ada97998f270ad45d46a986723852db0af54736f (patch) | |
tree | c8e6ea664ace5a2223d34241a66852143c36ecea /crypto/stack | |
parent | c6cc6e76a6919769977046df6a72a5bd8a171cef (diff) |
Fix stack macro const-ness.
sk_FOO_num may be called on const stacks. Given that was wrong, I suspect no
one ever uses a const STACK_OF(T)...
Other macros were correctly const, but were casting the constness a way (only
to have it come back again).
Also remove the extra newline after a group. It seems depending on which
version of clang-format was being used, we'd either lose or keep the extra
newline. The current file doesn't have them, so settle on that.
Change-Id: I19de6bc85b0a043d39c05ee3490321e9f0adec60
Reviewed-on: https://boringssl-review.googlesource.com/7946
Reviewed-by: Steven Valdez <svaldez@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Diffstat (limited to 'crypto/stack')
-rw-r--r-- | crypto/stack/make_macros.sh | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crypto/stack/make_macros.sh b/crypto/stack/make_macros.sh index 4837e449..3c3691b3 100644 --- a/crypto/stack/make_macros.sh +++ b/crypto/stack/make_macros.sh @@ -36,13 +36,13 @@ output_stack () { ((STACK_OF(${type})*) sk_new_null()) #define sk_${type}_num(sk)\\ - sk_num(CHECKED_CAST(_STACK*, STACK_OF(${type})*, sk)) + sk_num(CHECKED_CAST(const _STACK*, const STACK_OF(${type})*, sk)) #define sk_${type}_zero(sk)\\ sk_zero(CHECKED_CAST(_STACK*, STACK_OF(${type})*, sk)); #define sk_${type}_value(sk, i)\\ - ((${ptrtype}) sk_value(CHECKED_CAST(_STACK*, const STACK_OF(${type})*, sk), (i))) + ((${ptrtype}) sk_value(CHECKED_CAST(const _STACK*, const STACK_OF(${type})*, sk), (i))) #define sk_${type}_set(sk, i, p)\\ ((${ptrtype}) sk_set(CHECKED_CAST(_STACK*, STACK_OF(${type})*, sk), (i), CHECKED_CAST(void*, ${ptrtype}, p))) @@ -75,13 +75,13 @@ output_stack () { ((${ptrtype}) sk_pop(CHECKED_CAST(_STACK*, STACK_OF(${type})*, sk))) #define sk_${type}_dup(sk)\\ - ((STACK_OF(${type})*) sk_dup(CHECKED_CAST(_STACK*, const STACK_OF(${type})*, sk))) + ((STACK_OF(${type})*) sk_dup(CHECKED_CAST(const _STACK*, const STACK_OF(${type})*, sk))) #define sk_${type}_sort(sk)\\ sk_sort(CHECKED_CAST(_STACK*, STACK_OF(${type})*, sk)) #define sk_${type}_is_sorted(sk)\\ - sk_is_sorted(CHECKED_CAST(_STACK*, const STACK_OF(${type})*, sk)) + sk_is_sorted(CHECKED_CAST(const _STACK*, const STACK_OF(${type})*, sk)) #define sk_${type}_set_cmp_func(sk, comp)\\ ((int (*) (const ${type} **a, const ${type} **b)) sk_set_cmp_func(CHECKED_CAST(_STACK*, STACK_OF(${type})*, sk), CHECKED_CAST(stack_cmp_func, int (*) (const ${type} **a, const ${type} **b), comp))) @@ -89,7 +89,6 @@ output_stack () { #define sk_${type}_deep_copy(sk, copy_func, free_func)\\ ((STACK_OF(${type})*) sk_deep_copy(CHECKED_CAST(const _STACK*, const STACK_OF(${type})*, sk), CHECKED_CAST(void* (*) (void*), ${ptrtype} (*) (${ptrtype}), copy_func), CHECKED_CAST(void (*) (void*), void (*) (${ptrtype}), free_func))) - EOF } |