diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2009-07-27 23:10:00 +0200 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2009-07-27 23:10:00 +0200 |
commit | c869da8839ef5af9df5a4d98f518b079240a0d4b (patch) | |
tree | 4993ede240e5c1851ad9c32f304ee9f650193173 /crypto/txt_db | |
parent | Fix warnings. (diff) | |
download | openssl-c869da8839ef5af9df5a4d98f518b079240a0d4b.tar.xz openssl-c869da8839ef5af9df5a4d98f518b079240a0d4b.zip |
Update from 1.0.0-stable
Diffstat (limited to 'crypto/txt_db')
-rw-r--r-- | crypto/txt_db/txt_db.c | 60 | ||||
-rw-r--r-- | crypto/txt_db/txt_db.h | 18 |
2 files changed, 39 insertions, 39 deletions
diff --git a/crypto/txt_db/txt_db.c b/crypto/txt_db/txt_db.c index 7e33f143cb..6f2ce3b5a4 100644 --- a/crypto/txt_db/txt_db.c +++ b/crypto/txt_db/txt_db.c @@ -78,7 +78,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num) int size=BUFSIZE; int offset=0; char *p,*f; - STRING *pp; + OPENSSL_STRING *pp; BUF_MEM *buf=NULL; if ((buf=BUF_MEM_new()) == NULL) goto err; @@ -89,7 +89,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num) ret->num_fields=num; ret->index=NULL; ret->qual=NULL; - if ((ret->data=sk_PSTRING_new_null()) == NULL) + if ((ret->data=sk_OPENSSL_PSTRING_new_null()) == NULL) goto err; if ((ret->index=OPENSSL_malloc(sizeof(*ret->index)*num)) == NULL) goto err; @@ -163,7 +163,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num) goto err; } pp[n]=p; - if (!sk_PSTRING_push(ret->data,pp)) + if (!sk_OPENSSL_PSTRING_push(ret->data,pp)) { #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) /* temporary fix :-( */ fprintf(stderr,"failure in sk_push\n"); @@ -182,7 +182,7 @@ err: #endif if (ret != NULL) { - if (ret->data != NULL) sk_PSTRING_free(ret->data); + if (ret->data != NULL) sk_OPENSSL_PSTRING_free(ret->data); if (ret->index != NULL) OPENSSL_free(ret->index); if (ret->qual != NULL) OPENSSL_free(ret->qual); if (ret != NULL) OPENSSL_free(ret); @@ -193,10 +193,10 @@ err: return(ret); } -STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, STRING *value) +OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value) { - STRING *ret; - LHASH_OF(STRING) *lh; + OPENSSL_STRING *ret; + LHASH_OF(OPENSSL_STRING) *lh; if (idx >= db->num_fields) { @@ -209,16 +209,16 @@ STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, STRING *value) db->error=DB_ERROR_NO_INDEX; return(NULL); } - ret=lh_STRING_retrieve(lh,value); + ret=lh_OPENSSL_STRING_retrieve(lh,value); db->error=DB_ERROR_OK; return(ret); } -int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(STRING *), +int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(OPENSSL_STRING *), LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp) { - LHASH_OF(STRING) *idx; - STRING *r; + LHASH_OF(OPENSSL_STRING) *idx; + OPENSSL_STRING *r; int i,n; if (field >= db->num_fields) @@ -227,26 +227,26 @@ int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(STRING *), return(0); } /* FIXME: we lose type checking at this point */ - if ((idx=(LHASH_OF(STRING) *)lh_new(hash,cmp)) == NULL) + if ((idx=(LHASH_OF(OPENSSL_STRING) *)lh_new(hash,cmp)) == NULL) { db->error=DB_ERROR_MALLOC; return(0); } - n=sk_PSTRING_num(db->data); + n=sk_OPENSSL_PSTRING_num(db->data); for (i=0; i<n; i++) { - r=sk_PSTRING_value(db->data,i); + r=sk_OPENSSL_PSTRING_value(db->data,i); if ((qual != NULL) && (qual(r) == 0)) continue; - if ((r=lh_STRING_insert(idx,r)) != NULL) + if ((r=lh_OPENSSL_STRING_insert(idx,r)) != NULL) { db->error=DB_ERROR_INDEX_CLASH; - db->arg1=sk_PSTRING_find(db->data,r); + db->arg1=sk_OPENSSL_PSTRING_find(db->data,r); db->arg2=i; - lh_STRING_free(idx); + lh_OPENSSL_STRING_free(idx); return(0); } } - if (db->index[field] != NULL) lh_STRING_free(db->index[field]); + if (db->index[field] != NULL) lh_OPENSSL_STRING_free(db->index[field]); db->index[field]=idx; db->qual[field]=qual; return(1); @@ -261,11 +261,11 @@ long TXT_DB_write(BIO *out, TXT_DB *db) if ((buf=BUF_MEM_new()) == NULL) goto err; - n=sk_PSTRING_num(db->data); + n=sk_OPENSSL_PSTRING_num(db->data); nn=db->num_fields; for (i=0; i<n; i++) { - pp=sk_PSTRING_value(db->data,i); + pp=sk_OPENSSL_PSTRING_value(db->data,i); l=0; for (j=0; j<nn; j++) @@ -300,10 +300,10 @@ err: return(ret); } -int TXT_DB_insert(TXT_DB *db, STRING *row) +int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row) { int i; - STRING *r; + OPENSSL_STRING *r; for (i=0; i<db->num_fields; i++) { @@ -311,7 +311,7 @@ int TXT_DB_insert(TXT_DB *db, STRING *row) { if ((db->qual[i] != NULL) && (db->qual[i](row) == 0)) continue; - r=lh_STRING_retrieve(db->index[i],row); + r=lh_OPENSSL_STRING_retrieve(db->index[i],row); if (r != NULL) { db->error=DB_ERROR_INDEX_CLASH; @@ -322,7 +322,7 @@ int TXT_DB_insert(TXT_DB *db, STRING *row) } } /* We have passed the index checks, now just append and insert */ - if (!sk_PSTRING_push(db->data,row)) + if (!sk_OPENSSL_PSTRING_push(db->data,row)) { db->error=DB_ERROR_MALLOC; goto err; @@ -334,7 +334,7 @@ int TXT_DB_insert(TXT_DB *db, STRING *row) { if ((db->qual[i] != NULL) && (db->qual[i](row) == 0)) continue; - (void)lh_STRING_insert(db->index[i],row); + (void)lh_OPENSSL_STRING_insert(db->index[i],row); } } return(1); @@ -353,18 +353,18 @@ void TXT_DB_free(TXT_DB *db) if (db->index != NULL) { for (i=db->num_fields-1; i>=0; i--) - if (db->index[i] != NULL) lh_STRING_free(db->index[i]); + if (db->index[i] != NULL) lh_OPENSSL_STRING_free(db->index[i]); OPENSSL_free(db->index); } if (db->qual != NULL) OPENSSL_free(db->qual); if (db->data != NULL) { - for (i=sk_PSTRING_num(db->data)-1; i>=0; i--) + for (i=sk_OPENSSL_PSTRING_num(db->data)-1; i>=0; i--) { /* check if any 'fields' have been allocated * from outside of the initial block */ - p=sk_PSTRING_value(db->data,i); + p=sk_OPENSSL_PSTRING_value(db->data,i); max=p[db->num_fields]; /* last address */ if (max == NULL) /* new row */ { @@ -380,9 +380,9 @@ void TXT_DB_free(TXT_DB *db) OPENSSL_free(p[n]); } } - OPENSSL_free(sk_PSTRING_value(db->data,i)); + OPENSSL_free(sk_OPENSSL_PSTRING_value(db->data,i)); } - sk_PSTRING_free(db->data); + sk_OPENSSL_PSTRING_free(db->data); } OPENSSL_free(db); } diff --git a/crypto/txt_db/txt_db.h b/crypto/txt_db/txt_db.h index 4076493e45..6abe435bc8 100644 --- a/crypto/txt_db/txt_db.h +++ b/crypto/txt_db/txt_db.h @@ -77,19 +77,19 @@ extern "C" { #endif -typedef STRING *PSTRING; -DECLARE_SPECIAL_STACK_OF(PSTRING, STRING) +typedef OPENSSL_STRING *OPENSSL_PSTRING; +DECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) typedef struct txt_db_st { int num_fields; - STACK_OF(PSTRING) *data; - LHASH_OF(STRING) **index; - int (**qual)(STRING *); + STACK_OF(OPENSSL_PSTRING) *data; + LHASH_OF(OPENSSL_STRING) **index; + int (**qual)(OPENSSL_STRING *); long error; long arg1; long arg2; - STRING *arg_row; + OPENSSL_STRING *arg_row; } TXT_DB; #ifndef OPENSSL_NO_BIO @@ -99,11 +99,11 @@ long TXT_DB_write(BIO *out, TXT_DB *db); TXT_DB *TXT_DB_read(char *in, int num); long TXT_DB_write(char *out, TXT_DB *db); #endif -int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(STRING *), +int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(OPENSSL_STRING *), LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); void TXT_DB_free(TXT_DB *db); -STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, STRING *value); -int TXT_DB_insert(TXT_DB *db, STRING *value); +OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value); +int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); #ifdef __cplusplus } |