summaryrefslogtreecommitdiff
path: root/src/llist.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2013-02-17 09:01:46 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2013-02-17 09:19:04 +0100
commita363cb9b9111aed22d105adb0e7a8e9caab9bbe3 (patch)
treeb0be8fac73932dcde5b40d6f8cee777f501d869c /src/llist.c
parent8e16853201f8a608905cacbf1c7e4fb8ac7e568e (diff)
downloadcalcurse-a363cb9b9111aed22d105adb0e7a8e9caab9bbe3.zip
Fix braces in if-else statements
From the Linux kernel coding guidelines: Do not unnecessarily use braces where a single statement will do. [...] This does not apply if one branch of a conditional statement is a single statement. Use braces in both branches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/llist.c')
-rw-r--r--src/llist.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/llist.c b/src/llist.c
index 54f1e79..97e57f2 100644
--- a/src/llist.c
+++ b/src/llist.c
@@ -140,9 +140,9 @@ void llist_add(llist_t * l, void *data)
o->data = data;
o->next = NULL;
- if (!l->head)
+ if (!l->head) {
l->head = l->tail = o;
- else {
+ } else {
l->tail->next = o;
l->tail = o;
}
@@ -161,9 +161,9 @@ void llist_add_sorted(llist_t * l, void *data, llist_fn_cmp_t fn_cmp)
o->data = data;
o->next = NULL;
- if (!l->head)
+ if (!l->head) {
l->head = l->tail = o;
- else if (fn_cmp(o->data, l->tail->data) >= 0) {
+ } else if (fn_cmp(o->data, l->tail->data) >= 0) {
l->tail->next = o;
l->tail = o;
} else if (fn_cmp(o->data, l->head->data) < 0) {
@@ -186,9 +186,9 @@ void llist_remove(llist_t * l, llist_item_t * i)
{
llist_item_t *j = NULL;
- if (l->head && i == l->head)
+ if (l->head && i == l->head) {
l->head = i->next;
- else {
+ } else {
for (j = l->head; j && j->next != i; j = j->next) ;
}