diff options
author | Franziskus Kiefer <franziskuskiefer@gmail.com> | 2016-02-25 15:28:52 +0100 |
---|---|---|
committer | Franziskus Kiefer <franziskuskiefer@gmail.com> | 2016-02-25 15:28:52 +0100 |
commit | 11a75954a8c9f7d0c94f089d595b8c1da3a5ca83 (patch) | |
tree | b60e60f4ace2e9be9c6eb9dca0c7f15d7fba6e51 /lib/base | |
parent | db6e138764000f48d554bcf63526896d0f8036f1 (diff) | |
download | nss-hg-11a75954a8c9f7d0c94f089d595b8c1da3a5ca83.tar.gz |
Bug 1251185, NSS clang-format: else line-break fixes, r=ttaubertNSS_3_23_BETA7
Diffstat (limited to 'lib/base')
-rw-r--r-- | lib/base/arena.c | 18 | ||||
-rw-r--r-- | lib/base/error.c | 11 | ||||
-rw-r--r-- | lib/base/hash.c | 15 | ||||
-rw-r--r-- | lib/base/item.c | 3 | ||||
-rw-r--r-- | lib/base/libc.c | 3 | ||||
-rw-r--r-- | lib/base/list.c | 12 | ||||
-rw-r--r-- | lib/base/utf8.c | 39 |
7 files changed, 34 insertions, 67 deletions
diff --git a/lib/base/arena.c b/lib/base/arena.c index cefc03704..b8e64643d 100644 --- a/lib/base/arena.c +++ b/lib/base/arena.c @@ -530,8 +530,7 @@ nssArena_Mark(NSSArena *arena) /* Unmarked. Store our thread ID */ arena->marking_thread = PR_GetCurrentThread(); /* This call never fails. */ - } - else { + } else { /* Marked. Verify it's the current thread */ if (PR_GetCurrentThread() != arena->marking_thread) { PR_Unlock(arena->lock); @@ -556,8 +555,7 @@ nssArena_Mark(NSSArena *arena) if ((nssArenaMark *)NULL == arena->first_mark) { arena->first_mark = rv; arena->last_mark = rv; - } - else { + } else { arena->last_mark->next = rv; arena->last_mark = rv; } @@ -845,8 +843,7 @@ nss_ZAlloc(NSSArena *arenaOpt, PRUint32 size) /* We used calloc: it's already zeroed */ return (void *)((char *)h + sizeof(struct pointer_header)); - } - else { + } else { void *rv; /* Arena allocation */ #ifdef NSSDEBUG @@ -940,8 +937,7 @@ nss_ZFreeIf(void *pointer) (void)nsslibc_memset(pointer, 0, h->size); PR_Free(h); return PR_SUCCESS; - } - else { + } else { /* Arena */ #ifdef NSSDEBUG if (PR_SUCCESS != nssArena_verifyPointer(h->arena)) { @@ -1058,8 +1054,7 @@ nss_ZRealloc(void *pointer, PRUint32 newSize) (void)nsslibc_memcpy(rv, pointer, h->size); (void)nsslibc_memset(&((char *)rv)[h->size], 0, (newSize - h->size)); - } - else { + } else { (void)nsslibc_memcpy(rv, pointer, newSize); } @@ -1068,8 +1063,7 @@ nss_ZRealloc(void *pointer, PRUint32 newSize) PR_Free(h); return rv; - } - else { + } else { void *p; /* Arena */ #ifdef NSSDEBUG diff --git a/lib/base/error.c b/lib/base/error.c index 679f2ba9e..ea1d5e3e8 100644 --- a/lib/base/error.c +++ b/lib/base/error.c @@ -95,13 +95,11 @@ error_get_my_stack(void) if ((error_stack *)NULL == rv) { /* Doesn't exist; create one */ new_size = 16; - } - else if (rv->header.count == rv->header.space && - rv->header.count < NSS_MAX_ERROR_STACK_COUNT) { + } else if (rv->header.count == rv->header.space && + rv->header.count < NSS_MAX_ERROR_STACK_COUNT) { /* Too small, expand it */ new_size = PR_MIN(rv->header.space * 2, NSS_MAX_ERROR_STACK_COUNT); - } - else { + } else { /* Okay, return it */ return rv; } @@ -227,8 +225,7 @@ nss_SetError(PRUint32 error) if (es->header.count < es->header.space) { es->stack[es->header.count++] = error; - } - else { + } else { memmove(es->stack, es->stack + 1, (es->header.space - 1) * (sizeof es->stack[0])); es->stack[es->header.space - 1] = error; diff --git a/lib/base/hash.c b/lib/base/hash.c index ab2596f18..f9ee75803 100644 --- a/lib/base/hash.c +++ b/lib/base/hash.c @@ -92,8 +92,7 @@ nssHash_Create(NSSArena *arenaOpt, PRUint32 numBuckets, PLHashFunction keyHash, if (arenaOpt) { arena = arenaOpt; i_alloced = PR_FALSE; - } - else { + } else { arena = nssArena_Create(); i_alloced = PR_TRUE; } @@ -170,8 +169,7 @@ nssHash_Destroy(nssHash *hash) PL_HashTableDestroy(hash->plHashTable); if (hash->i_alloced_arena) { nssArena_Destroy(hash->arena); - } - else { + } else { nss_ZFreeIf(hash); } } @@ -191,11 +189,9 @@ nssHash_Add(nssHash *hash, const void *key, const void *value) he = PL_HashTableAdd(hash->plHashTable, key, (void *)value); if ((PLHashEntry *)NULL == he) { nss_SetError(NSS_ERROR_NO_MEMORY); - } - else if (he->value != value) { + } else if (he->value != value) { nss_SetError(NSS_ERROR_HASH_COLLISION); - } - else { + } else { hash->count++; error = PR_SUCCESS; } @@ -260,8 +256,7 @@ nssHash_Exists(nssHash *hash, const void *it) if ((void *)NULL == value) { return PR_FALSE; - } - else { + } else { return PR_TRUE; } } diff --git a/lib/base/item.c b/lib/base/item.c index 6c2591183..a1bb802ed 100644 --- a/lib/base/item.c +++ b/lib/base/item.c @@ -54,8 +54,7 @@ nssItem_Create(NSSArena *arenaOpt, NSSItem *rvOpt, PRUint32 length, if ((NSSItem *)NULL == rv) { goto loser; } - } - else { + } else { rv = rvOpt; } diff --git a/lib/base/libc.c b/lib/base/libc.c index 721e4a241..7954a3161 100644 --- a/lib/base/libc.c +++ b/lib/base/libc.c @@ -106,8 +106,7 @@ nsslibc_memequal(const void *a, const void *b, PRUint32 len, if (0 == memcmp(a, b, len)) { return PR_TRUE; - } - else { + } else { return PR_FALSE; } } diff --git a/lib/base/list.c b/lib/base/list.c index da4d7c0d8..0173b853b 100644 --- a/lib/base/list.c +++ b/lib/base/list.c @@ -83,8 +83,7 @@ nssList_Create(NSSArena *arenaOpt, PRBool threadSafe) if (arenaOpt) { arena = arenaOpt; i_alloced = PR_FALSE; - } - else { + } else { arena = nssArena_Create(); i_alloced = PR_TRUE; } @@ -103,8 +102,7 @@ nssList_Create(NSSArena *arenaOpt, PRBool threadSafe) if (!list->lock) { if (arenaOpt) { nss_ZFreeIf(list); - } - else { + } else { NSSArena_Destroy(arena); } return (nssList *)NULL; @@ -205,13 +203,11 @@ nsslist_add_element(nssList *list, void *data) } currNode = (nssListElement *)PR_NEXT_LINK(&currNode->link); } - } - else { + } else { /* not sorting */ PR_APPEND_LINK(&node->link, &list->head->link); } - } - else { + } else { list->head = node; } ++list->count; diff --git a/lib/base/utf8.c b/lib/base/utf8.c index 094e7254f..9ef197c89 100644 --- a/lib/base/utf8.c +++ b/lib/base/utf8.c @@ -61,8 +61,7 @@ nssUTF8_CaseIgnoreMatch(const NSSUTF8 *a, const NSSUTF8 *b, PRStatus *statusOpt) */ if (0 == PL_strcasecmp((const char *)a, (const char *)b)) { return PR_TRUE; - } - else { + } else { return PR_FALSE; } } @@ -167,8 +166,7 @@ nssUTF8_PrintableMatch(const NSSUTF8 *a, const NSSUTF8 *b, PRStatus *statusOpt) if (*c == *d) { /* And both '\0', btw */ return PR_TRUE; - } - else { + } else { return PR_FALSE; } } @@ -324,23 +322,17 @@ nssUTF8_Length(const NSSUTF8 *s, PRStatus *statusOpt) PRUint32 incr; if ((*c & 0x80) == 0) { incr = 1; - } - else if ((*c & 0xE0) == 0xC0) { + } else if ((*c & 0xE0) == 0xC0) { incr = 2; - } - else if ((*c & 0xF0) == 0xE0) { + } else if ((*c & 0xF0) == 0xE0) { incr = 3; - } - else if ((*c & 0xF8) == 0xF0) { + } else if ((*c & 0xF8) == 0xF0) { incr = 4; - } - else if ((*c & 0xFC) == 0xF8) { + } else if ((*c & 0xFC) == 0xF8) { incr = 5; - } - else if ((*c & 0xFE) == 0xFC) { + } else if ((*c & 0xFE) == 0xFC) { incr = 6; - } - else { + } else { nss_SetError(NSS_ERROR_INVALID_STRING); goto loser; } @@ -455,8 +447,7 @@ nssUTF8_Create(NSSArena *arenaOpt, nssStringType type, const void *inputString, if (0 == size) { rv = nssUTF8_Duplicate((const NSSUTF8 *)inputString, arenaOpt); - } - else { + } else { rv = nss_ZAlloc(arenaOpt, size + 1); if ((NSSUTF8 *)NULL == rv) { return (NSSUTF8 *)NULL; @@ -477,8 +468,7 @@ nssUTF8_Create(NSSArena *arenaOpt, nssStringType type, const void *inputString, case nssStringType_UTF8String: if (0 == size) { rv = nssUTF8_Duplicate((const NSSUTF8 *)inputString, arenaOpt); - } - else { + } else { rv = nss_ZAlloc(arenaOpt, size + 1); if ((NSSUTF8 *)NULL == rv) { return (NSSUTF8 *)NULL; @@ -555,8 +545,7 @@ nssUTF8_GetEncoding(NSSArena *arenaOpt, NSSItem *rvOpt, nssStringType type, (void)nss_ZFreeIf(dup); return (NSSItem *)NULL; } - } - else { + } else { rv = rvOpt; } @@ -640,13 +629,11 @@ nssUTF8_CopyIntoFixedBuffer(NSSUTF8 *string, char *buffer, PRUint32 bufferSize, if ((buffer[bs - 1] & 0xC0) != 0x80) { buffer[bs - 1] = pad; break; - } - else { + } else { buffer[bs - 1] = pad; } } - } - else { + } else { (void)nsslibc_memset(buffer, pad, bufferSize); (void)nsslibc_memcpy(buffer, string, stringSize); } |