diff options
author | Richard Levitte <levitte@openssl.org> | 2000-06-01 22:19:21 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2000-06-01 22:19:21 +0000 |
commit | 26a3a48d65c7464b400ec1de439994d7f0d25fed (patch) | |
tree | 91abb7d351b174e58f60e5353b731b916eaf0c5c /crypto/bio | |
parent | de42b6a7a82be33d2976ab605e74d7bc95b71447 (diff) |
There have been a number of complaints from a number of sources that names
like Malloc, Realloc and especially Free conflict with already existing names
on some operating systems or other packages. That is reason enough to change
the names of the OpenSSL memory allocation macros to something that has a
better chance of being unique, like prepending them with OPENSSL_.
This change includes all the name changes needed throughout all C files.
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/b_print.c | 6 | ||||
-rw-r--r-- | crypto/bio/b_sock.c | 28 | ||||
-rw-r--r-- | crypto/bio/bf_buff.c | 30 | ||||
-rw-r--r-- | crypto/bio/bf_nbio.c | 4 | ||||
-rw-r--r-- | crypto/bio/bio_lib.c | 6 | ||||
-rw-r--r-- | crypto/bio/bss_acpt.c | 10 | ||||
-rw-r--r-- | crypto/bio/bss_bio.c | 12 | ||||
-rw-r--r-- | crypto/bio/bss_conn.c | 18 | ||||
-rw-r--r-- | crypto/bio/bss_log.c | 8 | ||||
-rw-r--r-- | crypto/bio/bss_rtcp.c | 4 |
10 files changed, 63 insertions, 63 deletions
diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c index 33fa27ac6c..aafa85bd12 100644 --- a/crypto/bio/b_print.c +++ b/crypto/bio/b_print.c @@ -792,11 +792,11 @@ doapr_outch( if (*buffer == NULL) { if (*maxlen == 0) *maxlen = 1024; - *buffer = Malloc(*maxlen); + *buffer = OPENSSL_malloc(*maxlen); } while (*currlen >= *maxlen) { *maxlen += 1024; - *buffer = Realloc(*buffer, *maxlen); + *buffer = OPENSSL_realloc(*buffer, *maxlen); } /* What to do if *buffer is NULL? */ assert(*buffer != NULL); @@ -834,7 +834,7 @@ int BIO_printf (BIO *bio, const char *format, ...) ret=BIO_write(bio, hugebuf, (int)retlen); #ifdef USE_ALLOCATING_PRINT - Free(hugebuf); + OPENSSL_free(hugebuf); } CRYPTO_pop_info(); #endif diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c index 6409f98f57..b2958788b6 100644 --- a/crypto/bio/b_sock.c +++ b/crypto/bio/b_sock.c @@ -267,14 +267,14 @@ static struct hostent *ghbn_dup(struct hostent *a) int i,j; MemCheck_off(); - ret=(struct hostent *)Malloc(sizeof(struct hostent)); + ret=(struct hostent *)OPENSSL_malloc(sizeof(struct hostent)); if (ret == NULL) return(NULL); memset(ret,0,sizeof(struct hostent)); for (i=0; a->h_aliases[i] != NULL; i++) ; i++; - ret->h_aliases = (char **)Malloc(i*sizeof(char *)); + ret->h_aliases = (char **)OPENSSL_malloc(i*sizeof(char *)); if (ret->h_aliases == NULL) goto err; memset(ret->h_aliases, 0, i*sizeof(char *)); @@ -282,25 +282,25 @@ static struct hostent *ghbn_dup(struct hostent *a) for (i=0; a->h_addr_list[i] != NULL; i++) ; i++; - ret->h_addr_list=(char **)Malloc(i*sizeof(char *)); + ret->h_addr_list=(char **)OPENSSL_malloc(i*sizeof(char *)); if (ret->h_addr_list == NULL) goto err; memset(ret->h_addr_list, 0, i*sizeof(char *)); j=strlen(a->h_name)+1; - if ((ret->h_name=Malloc(j)) == NULL) goto err; + if ((ret->h_name=OPENSSL_malloc(j)) == NULL) goto err; memcpy((char *)ret->h_name,a->h_name,j); for (i=0; a->h_aliases[i] != NULL; i++) { j=strlen(a->h_aliases[i])+1; - if ((ret->h_aliases[i]=Malloc(j)) == NULL) goto err; + if ((ret->h_aliases[i]=OPENSSL_malloc(j)) == NULL) goto err; memcpy(ret->h_aliases[i],a->h_aliases[i],j); } ret->h_length=a->h_length; ret->h_addrtype=a->h_addrtype; for (i=0; a->h_addr_list[i] != NULL; i++) { - if ((ret->h_addr_list[i]=Malloc(a->h_length)) == NULL) + if ((ret->h_addr_list[i]=OPENSSL_malloc(a->h_length)) == NULL) goto err; memcpy(ret->h_addr_list[i],a->h_addr_list[i],a->h_length); } @@ -325,17 +325,17 @@ static void ghbn_free(struct hostent *a) if (a->h_aliases != NULL) { for (i=0; a->h_aliases[i] != NULL; i++) - Free(a->h_aliases[i]); - Free(a->h_aliases); + OPENSSL_free(a->h_aliases[i]); + OPENSSL_free(a->h_aliases); } if (a->h_addr_list != NULL) { for (i=0; a->h_addr_list[i] != NULL; i++) - Free(a->h_addr_list[i]); - Free(a->h_addr_list); + OPENSSL_free(a->h_addr_list[i]); + OPENSSL_free(a->h_addr_list); } - if (a->h_name != NULL) Free(a->h_name); - Free(a); + if (a->h_name != NULL) OPENSSL_free(a->h_name); + OPENSSL_free(a); } struct hostent *BIO_gethostbyname(const char *name) @@ -628,7 +628,7 @@ again: } ret=1; err: - if (str != NULL) Free(str); + if (str != NULL) OPENSSL_free(str); if ((ret == 0) && (s != INVALID_SOCKET)) { closesocket(s); @@ -667,7 +667,7 @@ int BIO_accept(int sock, char **addr) port=ntohs(from.sin_port); if (*addr == NULL) { - if ((p=Malloc(24)) == NULL) + if ((p=OPENSSL_malloc(24)) == NULL) { BIOerr(BIO_F_BIO_ACCEPT,ERR_R_MALLOC_FAILURE); goto end; diff --git a/crypto/bio/bf_buff.c b/crypto/bio/bf_buff.c index edffe92bce..e9916d29eb 100644 --- a/crypto/bio/bf_buff.c +++ b/crypto/bio/bf_buff.c @@ -95,12 +95,12 @@ static int buffer_new(BIO *bi) { BIO_F_BUFFER_CTX *ctx; - ctx=(BIO_F_BUFFER_CTX *)Malloc(sizeof(BIO_F_BUFFER_CTX)); + ctx=(BIO_F_BUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_F_BUFFER_CTX)); if (ctx == NULL) return(0); - ctx->ibuf=(char *)Malloc(DEFAULT_BUFFER_SIZE); - if (ctx->ibuf == NULL) { Free(ctx); return(0); } - ctx->obuf=(char *)Malloc(DEFAULT_BUFFER_SIZE); - if (ctx->obuf == NULL) { Free(ctx->ibuf); Free(ctx); return(0); } + ctx->ibuf=(char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE); + if (ctx->ibuf == NULL) { OPENSSL_free(ctx); return(0); } + ctx->obuf=(char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE); + if (ctx->obuf == NULL) { OPENSSL_free(ctx->ibuf); OPENSSL_free(ctx); return(0); } ctx->ibuf_size=DEFAULT_BUFFER_SIZE; ctx->obuf_size=DEFAULT_BUFFER_SIZE; ctx->ibuf_len=0; @@ -120,9 +120,9 @@ static int buffer_free(BIO *a) if (a == NULL) return(0); b=(BIO_F_BUFFER_CTX *)a->ptr; - if (b->ibuf != NULL) Free(b->ibuf); - if (b->obuf != NULL) Free(b->obuf); - Free(a->ptr); + if (b->ibuf != NULL) OPENSSL_free(b->ibuf); + if (b->obuf != NULL) OPENSSL_free(b->obuf); + OPENSSL_free(a->ptr); a->ptr=NULL; a->init=0; a->flags=0; @@ -319,9 +319,9 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) case BIO_C_SET_BUFF_READ_DATA: if (num > ctx->ibuf_size) { - p1=Malloc((int)num); + p1=OPENSSL_malloc((int)num); if (p1 == NULL) goto malloc_error; - if (ctx->ibuf != NULL) Free(ctx->ibuf); + if (ctx->ibuf != NULL) OPENSSL_free(ctx->ibuf); ctx->ibuf=p1; } ctx->ibuf_off=0; @@ -353,21 +353,21 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) p2=ctx->obuf; if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size)) { - p1=(char *)Malloc((int)num); + p1=(char *)OPENSSL_malloc((int)num); if (p1 == NULL) goto malloc_error; } if ((obs > DEFAULT_BUFFER_SIZE) && (obs != ctx->obuf_size)) { - p2=(char *)Malloc((int)num); + p2=(char *)OPENSSL_malloc((int)num); if (p2 == NULL) { - if (p1 != ctx->ibuf) Free(p1); + if (p1 != ctx->ibuf) OPENSSL_free(p1); goto malloc_error; } } if (ctx->ibuf != p1) { - Free(ctx->ibuf); + OPENSSL_free(ctx->ibuf); ctx->ibuf=p1; ctx->ibuf_off=0; ctx->ibuf_len=0; @@ -375,7 +375,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) } if (ctx->obuf != p2) { - Free(ctx->obuf); + OPENSSL_free(ctx->obuf); ctx->obuf=p2; ctx->obuf_off=0; ctx->obuf_len=0; diff --git a/crypto/bio/bf_nbio.c b/crypto/bio/bf_nbio.c index 9b4bcb19d4..a4a60a0c6d 100644 --- a/crypto/bio/bf_nbio.c +++ b/crypto/bio/bf_nbio.c @@ -104,7 +104,7 @@ static int nbiof_new(BIO *bi) { NBIO_TEST *nt; - nt=(NBIO_TEST *)Malloc(sizeof(NBIO_TEST)); + nt=(NBIO_TEST *)OPENSSL_malloc(sizeof(NBIO_TEST)); nt->lrn= -1; nt->lwn= -1; bi->ptr=(char *)nt; @@ -117,7 +117,7 @@ static int nbiof_free(BIO *a) { if (a == NULL) return(0); if (a->ptr != NULL) - Free(a->ptr); + OPENSSL_free(a->ptr); a->ptr=NULL; a->init=0; a->flags=0; diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index 77e43763cb..d8cb83aaab 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -70,7 +70,7 @@ BIO *BIO_new(BIO_METHOD *method) { BIO *ret=NULL; - ret=(BIO *)Malloc(sizeof(BIO)); + ret=(BIO *)OPENSSL_malloc(sizeof(BIO)); if (ret == NULL) { BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE); @@ -78,7 +78,7 @@ BIO *BIO_new(BIO_METHOD *method) } if (!BIO_set(ret,method)) { - Free(ret); + OPENSSL_free(ret); ret=NULL; } return(ret); @@ -133,7 +133,7 @@ int BIO_free(BIO *a) if ((a->method == NULL) || (a->method->destroy == NULL)) return(1); ret=a->method->destroy(a); - Free(a); + OPENSSL_free(a); return(1); } diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c index 09e8c90b53..4da5822062 100644 --- a/crypto/bio/bss_acpt.c +++ b/crypto/bio/bss_acpt.c @@ -145,7 +145,7 @@ BIO_ACCEPT *BIO_ACCEPT_new(void) { BIO_ACCEPT *ret; - if ((ret=(BIO_ACCEPT *)Malloc(sizeof(BIO_ACCEPT))) == NULL) + if ((ret=(BIO_ACCEPT *)OPENSSL_malloc(sizeof(BIO_ACCEPT))) == NULL) return(NULL); memset(ret,0,sizeof(BIO_ACCEPT)); @@ -159,10 +159,10 @@ void BIO_ACCEPT_free(BIO_ACCEPT *a) if(a == NULL) return; - if (a->param_addr != NULL) Free(a->param_addr); - if (a->addr != NULL) Free(a->addr); + if (a->param_addr != NULL) OPENSSL_free(a->param_addr); + if (a->addr != NULL) OPENSSL_free(a->addr); if (a->bio_chain != NULL) BIO_free(a->bio_chain); - Free(a); + OPENSSL_free(a); } static void acpt_close_socket(BIO *bio) @@ -355,7 +355,7 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr) { b->init=1; if (data->param_addr != NULL) - Free(data->param_addr); + OPENSSL_free(data->param_addr); data->param_addr=BUF_strdup(ptr); } else if (num == 1) diff --git a/crypto/bio/bss_bio.c b/crypto/bio/bss_bio.c index 94cc63c9fe..78c6ab4fdd 100644 --- a/crypto/bio/bss_bio.c +++ b/crypto/bio/bss_bio.c @@ -80,7 +80,7 @@ static int bio_new(BIO *bio) { struct bio_bio_st *b; - b = Malloc(sizeof *b); + b = OPENSSL_malloc(sizeof *b); if (b == NULL) return 0; @@ -108,10 +108,10 @@ static int bio_free(BIO *bio) if (b->buf != NULL) { - Free(b->buf); + OPENSSL_free(b->buf); } - Free(b); + OPENSSL_free(b); return 1; } @@ -464,7 +464,7 @@ static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr) { if (b->buf) { - Free(b->buf); + OPENSSL_free(b->buf); b->buf = NULL; } b->size = new_size; @@ -652,7 +652,7 @@ static int bio_make_pair(BIO *bio1, BIO *bio2) if (b1->buf == NULL) { - b1->buf = Malloc(b1->size); + b1->buf = OPENSSL_malloc(b1->size); if (b1->buf == NULL) { BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); @@ -664,7 +664,7 @@ static int bio_make_pair(BIO *bio1, BIO *bio2) if (b2->buf == NULL) { - b2->buf = Malloc(b2->size); + b2->buf = OPENSSL_malloc(b2->size); if (b2->buf == NULL) { BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index f0466adca3..1281a0af0d 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -165,7 +165,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c) break; } if (c->param_port != NULL) - Free(c->param_port); + OPENSSL_free(c->param_port); c->param_port=BUF_strdup(p); } } @@ -322,7 +322,7 @@ BIO_CONNECT *BIO_CONNECT_new(void) { BIO_CONNECT *ret; - if ((ret=(BIO_CONNECT *)Malloc(sizeof(BIO_CONNECT))) == NULL) + if ((ret=(BIO_CONNECT *)OPENSSL_malloc(sizeof(BIO_CONNECT))) == NULL) return(NULL); ret->state=BIO_CONN_S_BEFORE; ret->param_hostname=NULL; @@ -344,10 +344,10 @@ void BIO_CONNECT_free(BIO_CONNECT *a) return; if (a->param_hostname != NULL) - Free(a->param_hostname); + OPENSSL_free(a->param_hostname); if (a->param_port != NULL) - Free(a->param_port); - Free(a); + OPENSSL_free(a->param_port); + OPENSSL_free(a); } BIO_METHOD *BIO_s_connect(void) @@ -507,13 +507,13 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) if (num == 0) { if (data->param_hostname != NULL) - Free(data->param_hostname); + OPENSSL_free(data->param_hostname); data->param_hostname=BUF_strdup(ptr); } else if (num == 1) { if (data->param_port != NULL) - Free(data->param_port); + OPENSSL_free(data->param_port); data->param_port=BUF_strdup(ptr); } else if (num == 2) @@ -524,7 +524,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) sprintf(buf,"%d.%d.%d.%d", p[0],p[1],p[2],p[3]); if (data->param_hostname != NULL) - Free(data->param_hostname); + OPENSSL_free(data->param_hostname); data->param_hostname=BUF_strdup(buf); memcpy(&(data->ip[0]),ptr,4); } @@ -534,7 +534,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) sprintf(buf,"%d",*(int *)ptr); if (data->param_port != NULL) - Free(data->param_port); + OPENSSL_free(data->param_port); data->param_port=BUF_strdup(buf); data->port= *(int *)ptr; } diff --git a/crypto/bio/bss_log.c b/crypto/bio/bss_log.c index a8e01a0f93..be2ad38383 100644 --- a/crypto/bio/bss_log.c +++ b/crypto/bio/bss_log.c @@ -160,7 +160,7 @@ static int MS_CALLBACK slg_write(BIO *b, const char *in, int inl) char* pp; int priority; - if((buf= (char *)Malloc(inl+ 1)) == NULL){ + if((buf= (char *)OPENSSL_malloc(inl+ 1)) == NULL){ return(0); } strncpy(buf, in, inl); @@ -182,7 +182,7 @@ static int MS_CALLBACK slg_write(BIO *b, const char *in, int inl) xsyslog(b, priority, pp); - Free(buf); + OPENSSL_free(buf); return(ret); } @@ -294,7 +294,7 @@ static void xsyslog(BIO *bp, int priority, const char *string) lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string); /* we know there's an 8 byte header. That's documented */ - opcdef_p = (struct opcdef *) Malloc(8 + len); + opcdef_p = (struct opcdef *) OPENSSL_malloc(8 + len); opcdef_p->opc$b_ms_type = OPC$_RQ_RQST; memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3); opcdef_p->opc$l_ms_rqstid = 0; @@ -307,7 +307,7 @@ static void xsyslog(BIO *bp, int priority, const char *string) sys$sndopr(opc_dsc, 0); - Free(opcdef_p); + OPENSSL_free(opcdef_p); } static void xcloselog(BIO* bp) diff --git a/crypto/bio/bss_rtcp.c b/crypto/bio/bss_rtcp.c index 4ad0739464..1a0078ad6e 100644 --- a/crypto/bio/bss_rtcp.c +++ b/crypto/bio/bss_rtcp.c @@ -156,7 +156,7 @@ static int rtcp_new(BIO *bi) bi->init=1; bi->num=0; bi->flags = 0; - bi->ptr=Malloc(sizeof(struct rpc_ctx)); + bi->ptr=OPENSSL_malloc(sizeof(struct rpc_ctx)); ctx = (struct rpc_ctx *) bi->ptr; ctx->filled = 0; ctx->pos = 0; @@ -166,7 +166,7 @@ static int rtcp_new(BIO *bi) static int rtcp_free(BIO *a) { if (a == NULL) return(0); - if ( a->ptr ) Free ( a->ptr ); + if ( a->ptr ) OPENSSL_free ( a->ptr ); a->ptr = NULL; return(1); } |