Align coding style.

* lib/subordinateio.c: Avoid implicit conversion of pointers and
	integers to booleans.
	* lib/subordinateio.c: Added brackets.
This commit is contained in:
Nicolas François 2013-08-14 00:03:59 +02:00
parent cd1bd8bf4c
commit 0f26591422
2 changed files with 16 additions and 8 deletions

View File

@ -2,6 +2,9 @@
* lib/subordinateio.c: Avoid dead branches. * lib/subordinateio.c: Avoid dead branches.
* lib/subordinateio.c: Add schematics with ranges to help reviews. * 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> 2013-08-13 Nicolas François <nicolas.francois@centraliens.net>

View File

@ -280,34 +280,39 @@ static int add_range(struct commonio_db *db,
} }
static int remove_range (struct commonio_db *db, static int remove_range (struct commonio_db *db,
const char *owner, unsigned long start, unsigned long count) const char *owner,
unsigned long start, unsigned long count)
{ {
struct commonio_entry *ent; struct commonio_entry *ent;
unsigned long end; unsigned long end;
if (count == 0) if (count == 0) {
return 1; return 1;
}
end = start + count - 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; struct subordinate_range *range = ent->eptr;
unsigned long first; unsigned long first;
unsigned long last; unsigned long last;
/* Skip unparsed entries */ /* Skip unparsed entries */
if (!range) if (NULL == range) {
continue; continue;
}
first = range->start; first = range->start;
last = first + range->count - 1; last = first + range->count - 1;
/* Skip entries with a different owner */ /* Skip entries with a different owner */
if (0 != strcmp(range->owner, owner)) if (0 != strcmp (range->owner, owner)) {
continue; continue;
}
/* Skip entries outside of the range to remove */ /* Skip entries outside of the range to remove */
if ((end < first) || (start > last)) if ((end < first) || (start > last)) {
continue; continue;
}
if (start <= first) { if (start <= first) {
if (end >= last) { if (end >= last) {