From 79809d6cdc3a1e4dfb4466fc0e10040bd069211d Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 23 Feb 2016 20:19:50 +0100 Subject: [PATCH] cleanup: use sizeof instead of macro. Keep the buffer size defined at a single place and then use its sizeof. --- libdm/libdm-report.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c index 0163910d3..8250a350a 100644 --- a/libdm/libdm-report.c +++ b/libdm/libdm-report.c @@ -889,7 +889,7 @@ static void _all_match_combine(const struct dm_report_object_type *types, const struct dm_report_object_type *t; size_t prefix_len; - if (!_get_canonical_field_name(field, flen, field_canon, DM_REPORT_FIELD_TYPE_ID_LEN, NULL)) + if (!_get_canonical_field_name(field, flen, field_canon, sizeof(field_canon), NULL)) return; flen = strlen(field_canon); @@ -949,7 +949,7 @@ static int _get_field(struct dm_report *rh, const char *field, size_t flen, if (!flen) return 0; - if (!_get_canonical_field_name(field, flen, field_canon, DM_REPORT_FIELD_TYPE_ID_LEN, NULL)) + if (!_get_canonical_field_name(field, flen, field_canon, sizeof(field_canon), NULL)) return_0; for (f = 0; _implicit_report_fields[f].report_fn; f++) { @@ -1063,7 +1063,7 @@ static int _key_match(struct dm_report *rh, const char *key, size_t len, return 0; } - if (!_get_canonical_field_name(key, len, key_canon, DM_REPORT_FIELD_TYPE_ID_LEN, NULL)) + if (!_get_canonical_field_name(key, len, key_canon, sizeof(key_canon), NULL)) return_0; for (f = 0; _implicit_report_fields[f].report_fn; f++) @@ -1196,7 +1196,7 @@ static int _canonicalize_field_ids(struct dm_report *rh) for (i = 0; i < registered_field_count; i++) { if (!_get_canonical_field_name(rh->fields[i].id, strlen(rh->fields[i].id), - canonical_field, DM_REPORT_FIELD_TYPE_ID_LEN, &differs)) + canonical_field, sizeof(canonical_field), &differs)) return_0; if (differs) {