diff options
author | beck <> | 1999-09-29 04:37:45 +0000 |
---|---|---|
committer | beck <> | 1999-09-29 04:37:45 +0000 |
commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/buffer/buffer.c | |
parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip |
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libcrypto/buffer/buffer.c')
-rw-r--r-- | src/lib/libcrypto/buffer/buffer.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/lib/libcrypto/buffer/buffer.c b/src/lib/libcrypto/buffer/buffer.c index 7e8af9e2fa..c3a108ea52 100644 --- a/src/lib/libcrypto/buffer/buffer.c +++ b/src/lib/libcrypto/buffer/buffer.c | |||
@@ -58,13 +58,13 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include "buffer.h" | 61 | #include <openssl/buffer.h> |
62 | 62 | ||
63 | BUF_MEM *BUF_MEM_new() | 63 | BUF_MEM *BUF_MEM_new(void) |
64 | { | 64 | { |
65 | BUF_MEM *ret; | 65 | BUF_MEM *ret; |
66 | 66 | ||
67 | ret=(BUF_MEM *)Malloc(sizeof(BUF_MEM)); | 67 | ret=Malloc(sizeof(BUF_MEM)); |
68 | if (ret == NULL) | 68 | if (ret == NULL) |
69 | { | 69 | { |
70 | BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE); | 70 | BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE); |
@@ -76,9 +76,11 @@ BUF_MEM *BUF_MEM_new() | |||
76 | return(ret); | 76 | return(ret); |
77 | } | 77 | } |
78 | 78 | ||
79 | void BUF_MEM_free(a) | 79 | void BUF_MEM_free(BUF_MEM *a) |
80 | BUF_MEM *a; | ||
81 | { | 80 | { |
81 | if(a == NULL) | ||
82 | return; | ||
83 | |||
82 | if (a->data != NULL) | 84 | if (a->data != NULL) |
83 | { | 85 | { |
84 | memset(a->data,0,(unsigned int)a->max); | 86 | memset(a->data,0,(unsigned int)a->max); |
@@ -87,9 +89,7 @@ BUF_MEM *a; | |||
87 | Free(a); | 89 | Free(a); |
88 | } | 90 | } |
89 | 91 | ||
90 | int BUF_MEM_grow(str, len) | 92 | int BUF_MEM_grow(BUF_MEM *str, int len) |
91 | BUF_MEM *str; | ||
92 | int len; | ||
93 | { | 93 | { |
94 | char *ret; | 94 | char *ret; |
95 | unsigned int n; | 95 | unsigned int n; |
@@ -101,15 +101,15 @@ int len; | |||
101 | } | 101 | } |
102 | if (str->max >= len) | 102 | if (str->max >= len) |
103 | { | 103 | { |
104 | memset(&(str->data[str->length]),0,len-str->length); | 104 | memset(&str->data[str->length],0,len-str->length); |
105 | str->length=len; | 105 | str->length=len; |
106 | return(len); | 106 | return(len); |
107 | } | 107 | } |
108 | n=(len+3)/3*4; | 108 | n=(len+3)/3*4; |
109 | if (str->data == NULL) | 109 | if (str->data == NULL) |
110 | ret=(char *)Malloc(n); | 110 | ret=Malloc(n); |
111 | else | 111 | else |
112 | ret=(char *)Realloc(str->data,n); | 112 | ret=Realloc(str->data,n); |
113 | if (ret == NULL) | 113 | if (ret == NULL) |
114 | { | 114 | { |
115 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); | 115 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); |
@@ -124,8 +124,7 @@ int len; | |||
124 | return(len); | 124 | return(len); |
125 | } | 125 | } |
126 | 126 | ||
127 | char *BUF_strdup(str) | 127 | char *BUF_strdup(const char *str) |
128 | char *str; | ||
129 | { | 128 | { |
130 | char *ret; | 129 | char *ret; |
131 | int n; | 130 | int n; |