summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas François <nicolas.francois@centraliens.net>2013-08-14 00:03:59 +0200
committerNicolas François <nicolas.francois@centraliens.net>2013-08-14 00:19:19 +0200
commit0f2659142215f42a0f3fa94bf7da655d7275b630 (patch)
tree9094cfe7e66ed742460b5fbf06a3c909392608df
parentcd1bd8bf4ca936dc5af8b51648061e4e23949501 (diff)
Align coding style.
* lib/subordinateio.c: Avoid implicit conversion of pointers and integers to booleans. * lib/subordinateio.c: Added brackets.
-rw-r--r--ChangeLog3
-rw-r--r--lib/subordinateio.c21
2 files changed, 16 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b87be1f..73f74824 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
* lib/subordinateio.c: Avoid dead branches.
* lib/subordinateio.c: Add schematics with ranges to help reviews.
+ * lib/subordinateio.c: Avoid implicit conversion of pointers and
+ integers to booleans.
+ * lib/subordinateio.c: Added brackets.
2013-08-13 Nicolas François <nicolas.francois@centraliens.net>
diff --git a/lib/subordinateio.c b/lib/subordinateio.c
index 7811eb85..5a9f4743 100644
--- a/lib/subordinateio.c
+++ b/lib/subordinateio.c
@@ -279,35 +279,40 @@ static int add_range(struct commonio_db *db,
return commonio_append(db, &range);
}
-static int remove_range(struct commonio_db *db,
- const char *owner, unsigned long start, unsigned long count)
+static int remove_range (struct commonio_db *db,
+ const char *owner,
+ unsigned long start, unsigned long count)
{
struct commonio_entry *ent;
unsigned long end;
- if (count == 0)
+ if (count == 0) {
return 1;
+ }
end = start + count - 1;
- for (ent = db->head; ent; ent = ent->next) {
+ for (ent = db->head; NULL != ent; ent = ent->next) {
struct subordinate_range *range = ent->eptr;
unsigned long first;
unsigned long last;
/* Skip unparsed entries */
- if (!range)
+ if (NULL == range) {
continue;
+ }
first = range->start;
last = first + range->count - 1;
/* Skip entries with a different owner */
- if (0 != strcmp(range->owner, owner))
+ if (0 != strcmp (range->owner, owner)) {
continue;
+ }
/* Skip entries outside of the range to remove */
- if ((end < first) || (start > last))
+ if ((end < first) || (start > last)) {
continue;
+ }
if (start <= first) {
if (end >= last) {
@@ -345,7 +350,7 @@ static int remove_range(struct commonio_db *db,
tail.start = end + 1;
tail.count = (last - tail.start) + 1;
- if (commonio_append(db, &tail) == 0) {
+ if (commonio_append (db, &tail) == 0) {
return 0;
}