diff options
author | djm <> | 2008-09-06 12:17:54 +0000 |
---|---|---|
committer | djm <> | 2008-09-06 12:17:54 +0000 |
commit | 38ce604e3cc97706b876b0525ddff0121115456d (patch) | |
tree | 7ccc28afe1789ea3dbedf72365f955d5b8e105b5 /src/lib/libcrypto/txt_db | |
parent | 12867252827c8efaa8ddd1fa3b3d6e321e2bcdef (diff) | |
download | openbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.gz openbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.bz2 openbsd-38ce604e3cc97706b876b0525ddff0121115456d.zip |
resolve conflicts
Diffstat (limited to 'src/lib/libcrypto/txt_db')
-rw-r--r-- | src/lib/libcrypto/txt_db/txt_db.c | 23 | ||||
-rw-r--r-- | src/lib/libcrypto/txt_db/txt_db.h | 5 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/lib/libcrypto/txt_db/txt_db.c b/src/lib/libcrypto/txt_db/txt_db.c index 58b300b00b..3ed5f72ee9 100644 --- a/src/lib/libcrypto/txt_db/txt_db.c +++ b/src/lib/libcrypto/txt_db/txt_db.c | |||
@@ -66,7 +66,7 @@ | |||
66 | #undef BUFSIZE | 66 | #undef BUFSIZE |
67 | #define BUFSIZE 512 | 67 | #define BUFSIZE 512 |
68 | 68 | ||
69 | const char *TXT_DB_version="TXT_DB" OPENSSL_VERSION_PTEXT; | 69 | const char TXT_DB_version[]="TXT_DB" OPENSSL_VERSION_PTEXT; |
70 | 70 | ||
71 | TXT_DB *TXT_DB_read(BIO *in, int num) | 71 | TXT_DB *TXT_DB_read(BIO *in, int num) |
72 | { | 72 | { |
@@ -92,7 +92,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num) | |||
92 | goto err; | 92 | goto err; |
93 | if ((ret->index=(LHASH **)OPENSSL_malloc(sizeof(LHASH *)*num)) == NULL) | 93 | if ((ret->index=(LHASH **)OPENSSL_malloc(sizeof(LHASH *)*num)) == NULL) |
94 | goto err; | 94 | goto err; |
95 | if ((ret->qual=(int (**)())OPENSSL_malloc(sizeof(int (**)())*num)) == NULL) | 95 | if ((ret->qual=(int (**)(char **))OPENSSL_malloc(sizeof(int (**)(char **))*num)) == NULL) |
96 | goto err; | 96 | goto err; |
97 | for (i=0; i<num; i++) | 97 | for (i=0; i<num; i++) |
98 | { | 98 | { |
@@ -179,10 +179,13 @@ err: | |||
179 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) | 179 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) |
180 | if (er == 1) fprintf(stderr,"OPENSSL_malloc failure\n"); | 180 | if (er == 1) fprintf(stderr,"OPENSSL_malloc failure\n"); |
181 | #endif | 181 | #endif |
182 | if (ret->data != NULL) sk_free(ret->data); | 182 | if (ret != NULL) |
183 | if (ret->index != NULL) OPENSSL_free(ret->index); | 183 | { |
184 | if (ret->qual != NULL) OPENSSL_free(ret->qual); | 184 | if (ret->data != NULL) sk_free(ret->data); |
185 | if (ret != NULL) OPENSSL_free(ret); | 185 | if (ret->index != NULL) OPENSSL_free(ret->index); |
186 | if (ret->qual != NULL) OPENSSL_free(ret->qual); | ||
187 | if (ret != NULL) OPENSSL_free(ret); | ||
188 | } | ||
186 | return(NULL); | 189 | return(NULL); |
187 | } | 190 | } |
188 | else | 191 | else |
@@ -210,11 +213,11 @@ char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value) | |||
210 | return(ret); | 213 | return(ret); |
211 | } | 214 | } |
212 | 215 | ||
213 | int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(), | 216 | int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(char **), |
214 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp) | 217 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp) |
215 | { | 218 | { |
216 | LHASH *idx; | 219 | LHASH *idx; |
217 | char *r; | 220 | char **r; |
218 | int i,n; | 221 | int i,n; |
219 | 222 | ||
220 | if (field >= db->num_fields) | 223 | if (field >= db->num_fields) |
@@ -230,12 +233,12 @@ int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(), | |||
230 | n=sk_num(db->data); | 233 | n=sk_num(db->data); |
231 | for (i=0; i<n; i++) | 234 | for (i=0; i<n; i++) |
232 | { | 235 | { |
233 | r=(char *)sk_value(db->data,i); | 236 | r=(char **)sk_value(db->data,i); |
234 | if ((qual != NULL) && (qual(r) == 0)) continue; | 237 | if ((qual != NULL) && (qual(r) == 0)) continue; |
235 | if ((r=lh_insert(idx,r)) != NULL) | 238 | if ((r=lh_insert(idx,r)) != NULL) |
236 | { | 239 | { |
237 | db->error=DB_ERROR_INDEX_CLASH; | 240 | db->error=DB_ERROR_INDEX_CLASH; |
238 | db->arg1=sk_find(db->data,r); | 241 | db->arg1=sk_find(db->data,(char *)r); |
239 | db->arg2=i; | 242 | db->arg2=i; |
240 | lh_free(idx); | 243 | lh_free(idx); |
241 | return(0); | 244 | return(0); |
diff --git a/src/lib/libcrypto/txt_db/txt_db.h b/src/lib/libcrypto/txt_db/txt_db.h index 563392aeff..307e1ba23f 100644 --- a/src/lib/libcrypto/txt_db/txt_db.h +++ b/src/lib/libcrypto/txt_db/txt_db.h | |||
@@ -59,6 +59,7 @@ | |||
59 | #ifndef HEADER_TXT_DB_H | 59 | #ifndef HEADER_TXT_DB_H |
60 | #define HEADER_TXT_DB_H | 60 | #define HEADER_TXT_DB_H |
61 | 61 | ||
62 | #include <openssl/opensslconf.h> | ||
62 | #ifndef OPENSSL_NO_BIO | 63 | #ifndef OPENSSL_NO_BIO |
63 | #include <openssl/bio.h> | 64 | #include <openssl/bio.h> |
64 | #endif | 65 | #endif |
@@ -81,7 +82,7 @@ typedef struct txt_db_st | |||
81 | int num_fields; | 82 | int num_fields; |
82 | STACK /* char ** */ *data; | 83 | STACK /* char ** */ *data; |
83 | LHASH **index; | 84 | LHASH **index; |
84 | int (**qual)(); | 85 | int (**qual)(char **); |
85 | long error; | 86 | long error; |
86 | long arg1; | 87 | long arg1; |
87 | long arg2; | 88 | long arg2; |
@@ -95,7 +96,7 @@ long TXT_DB_write(BIO *out, TXT_DB *db); | |||
95 | TXT_DB *TXT_DB_read(char *in, int num); | 96 | TXT_DB *TXT_DB_read(char *in, int num); |
96 | long TXT_DB_write(char *out, TXT_DB *db); | 97 | long TXT_DB_write(char *out, TXT_DB *db); |
97 | #endif | 98 | #endif |
98 | int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(), | 99 | int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(char **), |
99 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); | 100 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); |
100 | void TXT_DB_free(TXT_DB *db); | 101 | void TXT_DB_free(TXT_DB *db); |
101 | char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value); | 102 | char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value); |