tree-wide: CMP()ify all the things

Let's employ coccinelle to fix everything up automatically for us.
This commit is contained in:
Lennart Poettering
2018-10-16 17:45:53 +02:00
parent f7eed93f15
commit 6dd91b3682
8 changed files with 40 additions and 67 deletions
+1 -6
View File
@@ -418,12 +418,7 @@ static int btrfs_ioctl_search_args_compare(const struct btrfs_ioctl_search_args
if (args->key.min_type > args->key.max_type)
return 1;
if (args->key.min_offset < args->key.max_offset)
return -1;
if (args->key.min_offset > args->key.max_offset)
return 1;
return 0;
return CMP(args->key.min_offset, args->key.max_offset);
}
#define FOREACH_BTRFS_IOCTL_SEARCH_HEADER(i, sh, args) \
+5 -26
View File
@@ -688,32 +688,16 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t
return 0;
case TABLE_TIMESTAMP:
if (a->timestamp < b->timestamp)
return -1;
if (a->timestamp > b->timestamp)
return 1;
return 0;
return CMP(a->timestamp, b->timestamp);
case TABLE_TIMESPAN:
if (a->timespan < b->timespan)
return -1;
if (a->timespan > b->timespan)
return 1;
return 0;
return CMP(a->timespan, b->timespan);
case TABLE_SIZE:
if (a->size < b->size)
return -1;
if (a->size > b->size)
return 1;
return 0;
return CMP(a->size, b->size);
case TABLE_UINT32:
if (a->uint32 < b->uint32)
return -1;
if (a->uint32 > b->uint32)
return 1;
return 0;
return CMP(a->uint32, b->uint32);
default:
;
@@ -721,12 +705,7 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t
}
/* Generic fallback using the orginal order in which the cells where added. */
if (index_a < index_b)
return -1;
if (index_a > index_b)
return 1;
return 0;
return CMP(index_a, index_b);
}
static int table_data_compare(const size_t *a, const size_t *b, Table *t) {
+1 -6
View File
@@ -398,12 +398,7 @@ int ascii_strcasecmp_nn(const char *a, size_t n, const char *b, size_t m) {
if (r != 0)
return r;
if (n < m)
return -1;
else if (n > m)
return 1;
else
return 0;
return CMP(n, m);
}
bool chars_intersect(const char *a, const char *b) {