diff options
author | Rich Salz <rsalz@openssl.org> | 2015-05-01 14:29:48 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-05-01 14:29:48 -0400 |
commit | 666964780a245c14e8f0eb6e13dd854a37387ea9 (patch) | |
tree | d50fcd19525107e6c675ab342e84805da21a684e /crypto/asn1/f_enum.c | |
parent | 190c8c60c11467424910605d8d0098ccc1168fdc (diff) | |
download | openssl-666964780a245c14e8f0eb6e13dd854a37387ea9.tar.gz |
Remove goto inside an if(0) block
There were a dozen-plus instances of this construct:
if (0) { label: ..... }
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/asn1/f_enum.c')
-rw-r--r-- | crypto/asn1/f_enum.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/crypto/asn1/f_enum.c b/crypto/asn1/f_enum.c index 338a02e291..eabfd3796e 100644 --- a/crypto/asn1/f_enum.c +++ b/crypto/asn1/f_enum.c @@ -97,7 +97,6 @@ int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a) int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) { - int ret = 0; int i, j, k, m, n, again, bufsize; unsigned char *s = NULL, *sp; unsigned char *bufp; @@ -108,16 +107,16 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) bufsize = BIO_gets(bp, buf, size); for (;;) { if (bufsize < 1) - goto err_sl; + goto err; i = bufsize; if (buf[i - 1] == '\n') buf[--i] = '\0'; if (i == 0) - goto err_sl; + goto err; if (buf[i - 1] == '\r') buf[--i] = '\0'; if (i == 0) - goto err_sl; + goto err; again = (buf[i - 1] == '\\'); for (j = 0; j < i; j++) { @@ -133,7 +132,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) * We have now cleared all the crap off the end of the line */ if (i < 2) - goto err_sl; + goto err; bufp = (unsigned char *)buf; if (first) { @@ -147,7 +146,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) i -= again; if (i % 2 != 0) { ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_ODD_NUMBER_OF_CHARS); - goto err; + return 0; } i /= 2; if (num + i > slen) { @@ -155,7 +154,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) if (sp == NULL) { ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ERR_R_MALLOC_FAILURE); OPENSSL_free(s); - goto err; + return 0; } s = sp; slen = num + i * 2; @@ -172,7 +171,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) else { ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_NON_HEX_CHARACTERS); - goto err; + return 0; } s[num + j] <<= 4; s[num + j] |= m; @@ -186,11 +185,9 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) } bs->length = num; bs->data = s; - ret = 1; + return 1; + err: - if (0) { - err_sl: - ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_SHORT_LINE); - } - return (ret); + ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_SHORT_LINE); + return 0; } |