diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-01-04 14:24:24 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-01-04 14:24:24 +0000 |
commit | dc1565216a5d20ae0d75872151523252309a1292 (patch) | |
tree | d57454ba9a40386552179eddf60d28bd1e8f3d54 /nss/lib/base/libc.c | |
parent | 26c046fbc57d53136b4fb3b5e0d18298318125d4 (diff) | |
download | nss-dc1565216a5d20ae0d75872151523252309a1292.tar.gz |
nss-3.28.1nss-3.28.1
Diffstat (limited to 'nss/lib/base/libc.c')
-rw-r--r-- | nss/lib/base/libc.c | 111 |
1 files changed, 45 insertions, 66 deletions
diff --git a/nss/lib/base/libc.c b/nss/lib/base/libc.c index 93a7627..7954a31 100644 --- a/nss/lib/base/libc.c +++ b/nss/lib/base/libc.c @@ -5,10 +5,10 @@ /* * libc.c * - * This file contains our wrappers/reimplementations for "standard" - * libc functions. Things like "memcpy." We add to this as we need - * it. Oh, and let's keep it in alphabetical order, should it ever - * get large. Most string/character stuff should be in utf8.c, not + * This file contains our wrappers/reimplementations for "standard" + * libc functions. Things like "memcpy." We add to this as we need + * it. Oh, and let's keep it in alphabetical order, should it ever + * get large. Most string/character stuff should be in utf8.c, not * here. This file (and maybe utf8.c) should be the only ones in * NSS to include files with angle brackets. */ @@ -38,21 +38,16 @@ */ NSS_IMPLEMENT void * -nsslibc_memcpy -( - void *dest, - const void *source, - PRUint32 n -) +nsslibc_memcpy(void *dest, const void *source, PRUint32 n) { #ifdef NSSDEBUG - if( ((void *)NULL == dest) || ((const void *)NULL == source) ) { - nss_SetError(NSS_ERROR_INVALID_POINTER); - return (void *)NULL; - } + if (((void *)NULL == dest) || ((const void *)NULL == source)) { + nss_SetError(NSS_ERROR_INVALID_POINTER); + return (void *)NULL; + } #endif /* NSSDEBUG */ - return memcpy(dest, source, (size_t)n); + return memcpy(dest, source, (size_t)n); } /* @@ -67,21 +62,16 @@ nsslibc_memcpy */ NSS_IMPLEMENT void * -nsslibc_memset -( - void *dest, - PRUint8 byte, - PRUint32 n -) +nsslibc_memset(void *dest, PRUint8 byte, PRUint32 n) { #ifdef NSSDEBUG - if( ((void *)NULL == dest) ) { - nss_SetError(NSS_ERROR_INVALID_POINTER); - return (void *)NULL; - } + if (((void *)NULL == dest)) { + nss_SetError(NSS_ERROR_INVALID_POINTER); + return (void *)NULL; + } #endif /* NSSDEBUG */ - return memset(dest, (int)byte, (size_t)n); + return memset(dest, (int)byte, (size_t)n); } /* @@ -97,33 +87,28 @@ nsslibc_memset */ NSS_IMPLEMENT PRBool -nsslibc_memequal -( - const void *a, - const void *b, - PRUint32 len, - PRStatus *statusOpt -) +nsslibc_memequal(const void *a, const void *b, PRUint32 len, + PRStatus *statusOpt) { #ifdef NSSDEBUG - if( (((void *)NULL == a) || ((void *)NULL == b)) ) { - nss_SetError(NSS_ERROR_INVALID_POINTER); - if( (PRStatus *)NULL != statusOpt ) { - *statusOpt = PR_FAILURE; + if ((((void *)NULL == a) || ((void *)NULL == b))) { + nss_SetError(NSS_ERROR_INVALID_POINTER); + if ((PRStatus *)NULL != statusOpt) { + *statusOpt = PR_FAILURE; + } + return PR_FALSE; } - return PR_FALSE; - } #endif /* NSSDEBUG */ - if( (PRStatus *)NULL != statusOpt ) { - *statusOpt = PR_SUCCESS; - } + if ((PRStatus *)NULL != statusOpt) { + *statusOpt = PR_SUCCESS; + } - if( 0 == memcmp(a, b, len) ) { - return PR_TRUE; - } else { - return PR_FALSE; - } + if (0 == memcmp(a, b, len)) { + return PR_TRUE; + } else { + return PR_FALSE; + } } /* @@ -131,32 +116,26 @@ nsslibc_memequal */ NSS_IMPLEMENT PRInt32 -nsslibc_memcmp -( - const void *a, - const void *b, - PRUint32 len, - PRStatus *statusOpt -) +nsslibc_memcmp(const void *a, const void *b, PRUint32 len, PRStatus *statusOpt) { - int v; + int v; #ifdef NSSDEBUG - if( (((void *)NULL == a) || ((void *)NULL == b)) ) { - nss_SetError(NSS_ERROR_INVALID_POINTER); - if( (PRStatus *)NULL != statusOpt ) { - *statusOpt = PR_FAILURE; + if ((((void *)NULL == a) || ((void *)NULL == b))) { + nss_SetError(NSS_ERROR_INVALID_POINTER); + if ((PRStatus *)NULL != statusOpt) { + *statusOpt = PR_FAILURE; + } + return -2; } - return -2; - } #endif /* NSSDEBUG */ - if( (PRStatus *)NULL != statusOpt ) { - *statusOpt = PR_SUCCESS; - } + if ((PRStatus *)NULL != statusOpt) { + *statusOpt = PR_SUCCESS; + } - v = memcmp(a, b, len); - return (PRInt32)v; + v = memcmp(a, b, len); + return (PRInt32)v; } /* |