Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2016-07-25 21:05:17 +0300
committerCQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>2016-07-25 21:44:46 +0300
commitebec9c341b97afa01ceab7853599a0c4198ea412 (patch)
tree8db57b02b13475b6b2a135a1b487cc2286042951
parent12d2c480864d6e60e78d77a6bb7a8c9585900456 (diff)
Inline bio_set.
It's only called in one place. The comment about stack-allocated BIOs no longer applies. Change-Id: I5a3cec30bcb46bf1ee2bffd6117485383520b314 Reviewed-on: https://boringssl-review.googlesource.com/8902 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: Adam Langley <agl@google.com> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
-rw-r--r--crypto/bio/bio.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/crypto/bio/bio.c b/crypto/bio/bio.c
index 7a1a9e3b..6f112c1a 100644
--- a/crypto/bio/bio.c
+++ b/crypto/bio/bio.c
@@ -68,25 +68,6 @@
#include "../internal.h"
-/* BIO_set initialises a BIO structure to have the given type and sets the
- * reference count to one. It returns one on success or zero on error. */
-static int bio_set(BIO *bio, const BIO_METHOD *method) {
- /* This function can be called with a stack allocated |BIO| so we have to
- * assume that the contents of |BIO| are arbitary. This also means that it'll
- * leak memory if you call |BIO_set| twice on the same BIO. */
- memset(bio, 0, sizeof(BIO));
-
- bio->method = method;
- bio->shutdown = 1;
- bio->references = 1;
-
- if (method->create != NULL && !method->create(bio)) {
- return 0;
- }
-
- return 1;
-}
-
BIO *BIO_new(const BIO_METHOD *method) {
BIO *ret = OPENSSL_malloc(sizeof(BIO));
if (ret == NULL) {
@@ -94,9 +75,14 @@ BIO *BIO_new(const BIO_METHOD *method) {
return NULL;
}
- if (!bio_set(ret, method)) {
+ memset(ret, 0, sizeof(BIO));
+ ret->method = method;
+ ret->shutdown = 1;
+ ret->references = 1;
+
+ if (method->create != NULL && !method->create(ret)) {
OPENSSL_free(ret);
- ret = NULL;
+ return NULL;
}
return ret;