diff options
author | Dr. Stephen Henson <steve@openssl.org> | 1999-06-20 22:18:16 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 1999-06-20 22:18:16 +0000 |
commit | ba404b5e86a707afe7faca8e22d53eea5e64c8b6 (patch) | |
tree | e1ae9500f211bc5cb067ec366b0e3f8caf1e03e6 /crypto/conf | |
parent | 8623f693d9a5c74f76311aebd29767e89467ecea (diff) | |
download | openssl-new-ba404b5e86a707afe7faca8e22d53eea5e64c8b6.tar.gz |
Convert the CONF library to use a typesafe stack: a STACK_OF(CONF_VALUE). It
seemed like a good idea at the time... several hours later it was rather
obvious that these are used all over the place making the changes rather
extensive.
Diffstat (limited to 'crypto/conf')
-rw-r--r-- | crypto/conf/conf.c | 22 | ||||
-rw-r--r-- | crypto/conf/conf.h | 5 |
2 files changed, 16 insertions, 11 deletions
diff --git a/crypto/conf/conf.c b/crypto/conf/conf.c index 3a055fac3c..f98451e77d 100644 --- a/crypto/conf/conf.c +++ b/crypto/conf/conf.c @@ -134,7 +134,7 @@ LHASH *CONF_load_bio(LHASH *h, BIO *in, long *line) CONF_VALUE *v=NULL,*vv,*tv; CONF_VALUE *sv=NULL; char *section=NULL,*buf; - STACK *section_sk=NULL,*ts; + STACK_OF(CONF_VALUE) *section_sk=NULL,*ts; char *start,*psection,*pname; if ((buff=BUF_MEM_new()) == NULL) @@ -169,7 +169,7 @@ LHASH *CONF_load_bio(LHASH *h, BIO *in, long *line) CONF_R_UNABLE_TO_CREATE_NEW_SECTION); goto err; } - section_sk=(STACK *)sv->value; + section_sk=(STACK_OF(CONF_VALUE) *)sv->value; bufnum=0; for (;;) @@ -261,7 +261,7 @@ again: CONF_R_UNABLE_TO_CREATE_NEW_SECTION); goto err; } - section_sk=(STACK *)sv->value; + section_sk=(STACK_OF(CONF_VALUE) *)sv->value; continue; } else @@ -295,7 +295,7 @@ again: p++; *p='\0'; - if ((v=(CONF_VALUE *)Malloc(sizeof(CONF_VALUE))) == NULL) + if (!(v=(CONF_VALUE *)Malloc(sizeof(CONF_VALUE)))) { CONFerr(CONF_F_CONF_LOAD_BIO, ERR_R_MALLOC_FAILURE); @@ -321,10 +321,10 @@ again: if (tv == NULL) { CONFerr(CONF_F_CONF_LOAD_BIO, - CONF_R_UNABLE_TO_CREATE_NEW_SECTION); + CONF_R_UNABLE_TO_CREATE_NEW_SECTION); goto err; } - ts=(STACK *)tv->value; + ts=(STACK_OF(CONF_VALUE) *)tv->value; } else { @@ -332,7 +332,7 @@ again: ts=section_sk; } v->section=tv->section; - if (!sk_push(ts,(char *)v)) + if (!sk_CONF_VALUE_push(ts,v)) { CONFerr(CONF_F_CONF_LOAD_BIO, ERR_R_MALLOC_FAILURE); @@ -341,7 +341,7 @@ again: vv=(CONF_VALUE *)lh_insert(ret,(char *)v); if (vv != NULL) { - sk_delete_ptr(ts,(char *)vv); + sk_CONF_VALUE_delete_ptr(ts,vv); Free(vv->name); Free(vv->value); Free(vv); @@ -411,13 +411,13 @@ static CONF_VALUE *get_section(LHASH *conf, char *section) return(v); } -STACK *CONF_get_section(LHASH *conf, char *section) +STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf, char *section) { CONF_VALUE *v; v=get_section(conf,section); if (v != NULL) - return((STACK *)v->value); + return((STACK_OF(CONF_VALUE) *)v->value); else return(NULL); } @@ -728,3 +728,5 @@ err: } return(v); } + +IMPLEMENT_STACK_OF(CONF_VALUE) diff --git a/crypto/conf/conf.h b/crypto/conf/conf.h index feb65f2a7d..e7c5150097 100644 --- a/crypto/conf/conf.h +++ b/crypto/conf/conf.h @@ -66,6 +66,7 @@ extern "C" { #include <openssl/bio.h> #include <openssl/lhash.h> #include <openssl/stack.h> +#include <openssl/safestack.h> typedef struct { @@ -74,16 +75,18 @@ typedef struct char *value; } CONF_VALUE; +DECLARE_STACK_OF(CONF_VALUE) LHASH *CONF_load(LHASH *conf,const char *file,long *eline); LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline); LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline); -STACK *CONF_get_section(LHASH *conf,char *section); +STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section); char *CONF_get_string(LHASH *conf,char *group,char *name); long CONF_get_number(LHASH *conf,char *group,char *name); void CONF_free(LHASH *conf); void ERR_load_CONF_strings(void ); + /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. |