diff options
author | 2008-09-06 12:17:47 +0000 | |
---|---|---|
committer | 2008-09-06 12:17:47 +0000 | |
commit | 4fcf65c5c59fcf6124cf9f1fd81aa546850f974c (patch) | |
tree | 3c0b4c46d91bcb87c8eef7a1e84711159b17f71b /lib/libcrypto/stack/stack.c | |
parent | import of OpenSSL 0.9.8h (diff) | |
download | wireguard-openbsd-4fcf65c5c59fcf6124cf9f1fd81aa546850f974c.tar.xz wireguard-openbsd-4fcf65c5c59fcf6124cf9f1fd81aa546850f974c.zip |
resolve conflicts
Diffstat (limited to 'lib/libcrypto/stack/stack.c')
-rw-r--r-- | lib/libcrypto/stack/stack.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/libcrypto/stack/stack.c b/lib/libcrypto/stack/stack.c index c7173eb6ab2..378bd7c7968 100644 --- a/lib/libcrypto/stack/stack.c +++ b/lib/libcrypto/stack/stack.c @@ -68,11 +68,12 @@ #include <stdio.h> #include "cryptlib.h" #include <openssl/stack.h> +#include <openssl/objects.h> #undef MIN_NODES #define MIN_NODES 4 -const char *STACK_version="Stack" OPENSSL_VERSION_PTEXT; +const char STACK_version[]="Stack" OPENSSL_VERSION_PTEXT; #include <errno.h> @@ -209,7 +210,7 @@ char *sk_delete(STACK *st, int loc) return(ret); } -int sk_find(STACK *st, char *data) +static int internal_find(STACK *st, char *data, int ret_val_options) { char **r; int i; @@ -232,19 +233,19 @@ int sk_find(STACK *st, char *data) * not (type *) pointers, but the *pointers* to (type *) pointers, * so we get our extra level of pointer dereferencing that way. */ comp_func=(int (*)(const void *,const void *))(st->comp); - r=(char **)bsearch(&data,(char *)st->data, - st->num,sizeof(char *), comp_func); + r=(char **)OBJ_bsearch_ex((char *)&data,(char *)st->data, + st->num,sizeof(char *),comp_func,ret_val_options); if (r == NULL) return(-1); - i=(int)(r-st->data); - for ( ; i>0; i--) - /* This needs a cast because the type being pointed to from - * the "&" expressions are (char *) rather than (const char *). - * For an explanation, read: - * http://www.eskimo.com/~scs/C-faq/q11.10.html :-) */ - if ((*st->comp)((const char * const *)&(st->data[i-1]), - (const char * const *)&data) < 0) - break; - return(i); + return((int)(r-st->data)); + } + +int sk_find(STACK *st, char *data) + { + return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); + } +int sk_find_ex(STACK *st, char *data) + { + return internal_find(st, data, OBJ_BSEARCH_VALUE_ON_NOMATCH); } int sk_push(STACK *st, char *data) |