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>
This commit is contained in:
David Benjamin 2016-05-13 13:14:28 -04:00
parent c6cc6e76a6
commit ada97998f2
2 changed files with 330 additions and 279 deletions

View File

@ -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
}

File diff suppressed because it is too large Load Diff