diff options
| author | 2014-04-14 14:59:47 +0000 | |
|---|---|---|
| committer | 2014-04-14 14:59:47 +0000 | |
| commit | 7c408a0868fbcc7733ea48d1a7de8769964192b6 (patch) | |
| tree | a714d5f1a8a4f05018ffe886ad8f0b9e5369d092 /lib/libssl/src/ssl/LPdir_unix.c | |
| parent | Remove the CAPI engine: It is a backend for the Windows CryptoAPI and (diff) | |
| download | wireguard-openbsd-7c408a0868fbcc7733ea48d1a7de8769964192b6.tar.xz wireguard-openbsd-7c408a0868fbcc7733ea48d1a7de8769964192b6.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/ssl/LPdir_unix.c')
| -rw-r--r-- | lib/libssl/src/ssl/LPdir_unix.c | 102 |
1 files changed, 48 insertions, 54 deletions
diff --git a/lib/libssl/src/ssl/LPdir_unix.c b/lib/libssl/src/ssl/LPdir_unix.c index b004cd99e8a..000a1bd8193 100644 --- a/lib/libssl/src/ssl/LPdir_unix.c +++ b/lib/libssl/src/ssl/LPdir_unix.c @@ -56,72 +56,66 @@ # define LP_ENTRY_SIZE 255 #endif -struct LP_dir_context_st -{ - DIR *dir; - char entry_name[LP_ENTRY_SIZE+1]; +struct LP_dir_context_st { + DIR *dir; + char entry_name[LP_ENTRY_SIZE + 1]; }; -const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) +const char +*LP_find_file(LP_DIR_CTX **ctx, const char *directory) { - struct dirent *direntry = NULL; - - if (ctx == NULL || directory == NULL) - { - errno = EINVAL; - return 0; - } + struct dirent *direntry = NULL; - errno = 0; - if (*ctx == NULL) - { - *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); - if (*ctx == NULL) - { - errno = ENOMEM; - return 0; + if (ctx == NULL || directory == NULL) { + errno = EINVAL; + return 0; } - memset(*ctx, '\0', sizeof(LP_DIR_CTX)); - (*ctx)->dir = opendir(directory); - if ((*ctx)->dir == NULL) - { - int save_errno = errno; /* Probably not needed, but I'm paranoid */ - free(*ctx); - *ctx = NULL; - errno = save_errno; - return 0; + errno = 0; + if (*ctx == NULL) { + *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); + if (*ctx == NULL) { + errno = ENOMEM; + return 0; + } + memset(*ctx, '\0', sizeof(LP_DIR_CTX)); + + (*ctx)->dir = opendir(directory); + if ((*ctx)->dir == NULL) { + int save_errno = errno; /* Probably not needed, but I'm paranoid */ + free(*ctx); + *ctx = NULL; + errno = save_errno; + return 0; + } } - } - direntry = readdir((*ctx)->dir); - if (direntry == NULL) - { - return 0; - } + direntry = readdir((*ctx)->dir); + if (direntry == NULL) { + return 0; + } - strncpy((*ctx)->entry_name, direntry->d_name, sizeof((*ctx)->entry_name) - 1); - (*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0'; - return (*ctx)->entry_name; + strncpy((*ctx)->entry_name, direntry->d_name, sizeof((*ctx)->entry_name) - 1); + (*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0'; + return (*ctx)->entry_name; } -int LP_find_file_end(LP_DIR_CTX **ctx) +int +LP_find_file_end(LP_DIR_CTX **ctx) { - if (ctx != NULL && *ctx != NULL) - { - int ret = closedir((*ctx)->dir); + if (ctx != NULL && *ctx != NULL) { + int ret = closedir((*ctx)->dir); - free(*ctx); - switch (ret) - { - case 0: - return 1; - case -1: - return 0; - default: - break; + free(*ctx); + switch (ret) { + case 0: + return 1; + case -1: + return 0; + default: + break; + } } - } - errno = EINVAL; - return 0; + errno = EINVAL; + return 0; } |
