diff options
author | 2014-04-15 16:37:21 +0000 | |
---|---|---|
committer | 2014-04-15 16:37:21 +0000 | |
commit | c3d505be928f54a35067888fc76997fb1d51a8b2 (patch) | |
tree | 53bbd1b8d948cd21127c1759ad58bea34ed6d068 /lib/libssl/src/crypto/bio/bio_cb.c | |
parent | Convert some BIO_snprintf() to (void) snprintf - as although these ones (diff) | |
download | wireguard-openbsd-c3d505be928f54a35067888fc76997fb1d51a8b2.tar.xz wireguard-openbsd-c3d505be928f54a35067888fc76997fb1d51a8b2.zip |
First pass at applying KNF to the OpenSSL code, which almost makes it
readable. This pass is whitespace only and can readily be verified using
tr and md5.
Diffstat (limited to 'lib/libssl/src/crypto/bio/bio_cb.c')
-rw-r--r-- | lib/libssl/src/crypto/bio/bio_cb.c | 78 |
1 files changed, 41 insertions, 37 deletions
diff --git a/lib/libssl/src/crypto/bio/bio_cb.c b/lib/libssl/src/crypto/bio/bio_cb.c index 78c8974ab45..3e110f3751a 100644 --- a/lib/libssl/src/crypto/bio/bio_cb.c +++ b/lib/libssl/src/crypto/bio/bio_cb.c @@ -63,81 +63,85 @@ #include <openssl/bio.h> #include <openssl/err.h> -long BIO_debug_callback(BIO *bio, int cmd, const char *argp, - int argi, long argl, long ret) - { +long +BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, + long ret) +{ BIO *b; char buf[256]; char *p; - long r=1; + long r = 1; size_t p_maxlen; if (BIO_CB_RETURN & cmd) - r=ret; + r = ret; - (void) snprintf(buf,sizeof buf,"BIO[%08lX]:",(unsigned long)bio); - p= &(buf[14]); + (void) snprintf(buf, sizeof buf, "BIO[%08lX]:", (unsigned long)bio); + p = &(buf[14]); p_maxlen = sizeof buf - 14; - switch (cmd) - { + switch (cmd) { case BIO_CB_FREE: - (void) snprintf(p,p_maxlen,"Free - %s\n",bio->method->name); + (void) snprintf(p, p_maxlen, "Free - %s\n", bio->method->name); break; case BIO_CB_READ: if (bio->method->type & BIO_TYPE_DESCRIPTOR) - (void) snprintf(p,p_maxlen,"read(%d,%lu) - %s fd=%d\n", - bio->num,(unsigned long)argi, - bio->method->name,bio->num); + (void) snprintf(p, p_maxlen, + "read(%d,%lu) - %s fd=%d\n", + bio->num,(unsigned long)argi, + bio->method->name, bio->num); else - (void) snprintf(p,p_maxlen,"read(%d,%lu) - %s\n", - bio->num,(unsigned long)argi, - bio->method->name); + (void) snprintf(p, p_maxlen, "read(%d,%lu) - %s\n", + bio->num, (unsigned long)argi, bio->method->name); break; case BIO_CB_WRITE: if (bio->method->type & BIO_TYPE_DESCRIPTOR) - (void) snprintf(p,p_maxlen,"write(%d,%lu) - %s fd=%d\n", - bio->num,(unsigned long)argi, - bio->method->name,bio->num); + (void) snprintf(p, p_maxlen, + "write(%d,%lu) - %s fd=%d\n", + bio->num, (unsigned long)argi, + bio->method->name, bio->num); else - (void) snprintf(p,p_maxlen,"write(%d,%lu) - %s\n", - bio->num,(unsigned long)argi, - bio->method->name); + (void) snprintf(p, p_maxlen, "write(%d,%lu) - %s\n", + bio->num, (unsigned long)argi, bio->method->name); break; case BIO_CB_PUTS: - (void) snprintf(p,p_maxlen,"puts() - %s\n",bio->method->name); + (void) snprintf(p, p_maxlen, + "puts() - %s\n", bio->method->name); break; case BIO_CB_GETS: - (void) snprintf(p,p_maxlen,"gets(%lu) - %s\n",(unsigned long)argi,bio->method->name); + (void) snprintf(p, p_maxlen, "gets(%lu) - %s\n", + (unsigned long)argi, bio->method->name); break; case BIO_CB_CTRL: - (void) snprintf(p,p_maxlen,"ctrl(%lu) - %s\n",(unsigned long)argi,bio->method->name); + (void) snprintf(p, p_maxlen, "ctrl(%lu) - %s\n", + (unsigned long)argi, bio->method->name); break; case BIO_CB_RETURN|BIO_CB_READ: - (void) snprintf(p,p_maxlen,"read return %ld\n",ret); + (void) snprintf(p, p_maxlen, "read return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_WRITE: - (void) snprintf(p,p_maxlen,"write return %ld\n",ret); + (void) snprintf(p, p_maxlen, "write return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_GETS: - (void) snprintf(p,p_maxlen,"gets return %ld\n",ret); + (void) snprintf(p, p_maxlen, "gets return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_PUTS: - (void) snprintf(p,p_maxlen,"puts return %ld\n",ret); + (void) snprintf(p, p_maxlen, "puts return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_CTRL: - (void) snprintf(p,p_maxlen,"ctrl return %ld\n",ret); + (void) snprintf(p, p_maxlen, "ctrl return %ld\n", ret); break; default: - (void) snprintf(p,p_maxlen,"bio callback - unknown type (%d)\n",cmd); + (void) snprintf(p, p_maxlen, + "bio callback - unknown type (%d)\n", cmd); break; - } + } - b=(BIO *)bio->cb_arg; + b = (BIO *)bio->cb_arg; if (b != NULL) - BIO_write(b,buf,strlen(buf)); + BIO_write(b, buf, strlen(buf)); #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) else - fputs(buf,stderr); + fputs(buf, stderr); #endif - return(r); - } + return (r); +} |