From: Michael Tremer Date: Thu, 18 Aug 2022 19:43:41 +0000 (+0000) Subject: Remove unnecessary use of sizeof(x) - 1 X-Git-Tag: 0.9.28~441 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9ca0393d874eafc5d4f5fa98c215374bc73538f;p=pakfire.git Remove unnecessary use of sizeof(x) - 1 Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/include/pakfire/pakfire.h b/src/libpakfire/include/pakfire/pakfire.h index e626affae..a0be568c8 100644 --- a/src/libpakfire/include/pakfire/pakfire.h +++ b/src/libpakfire/include/pakfire/pakfire.h @@ -168,7 +168,7 @@ int __pakfire_path(struct pakfire* pakfire, char* path, const size_t length, const char* pakfire_relpath(struct pakfire* pakfire, const char* path); #define pakfire_make_cache_path(pakfire, path, format, ...) \ - __pakfire_make_cache_path(pakfire, path, sizeof(path) - 1, format, __VA_ARGS__) + __pakfire_make_cache_path(pakfire, path, sizeof(path), format, __VA_ARGS__) int __pakfire_make_cache_path(struct pakfire* pakfire, char* path, size_t length, const char* format, ...) __attribute__((format(printf, 4, 5))); diff --git a/src/libpakfire/include/pakfire/string.h b/src/libpakfire/include/pakfire/string.h index 43ab71095..510217ba2 100644 --- a/src/libpakfire/include/pakfire/string.h +++ b/src/libpakfire/include/pakfire/string.h @@ -50,7 +50,7 @@ char** pakfire_string_split(const char* s, char delim); char* pakfire_string_join(char** list, const char* delim); #define pakfire_format_size(dst, value) \ - __pakfire_format_size(dst, sizeof(dst) - 1, value) + __pakfire_format_size(dst, sizeof(dst), value) int __pakfire_format_size(char* dst, size_t length, double value); int pakfire_format_speed(char* dst, size_t length, double value); diff --git a/src/libpakfire/progressbar.c b/src/libpakfire/progressbar.c index ce9211c22..9ff9adb7b 100644 --- a/src/libpakfire/progressbar.c +++ b/src/libpakfire/progressbar.c @@ -611,7 +611,7 @@ static const char* pakfire_progressbar_transfer_speed(struct pakfire_progressbar if (t <= 0) return NULL; - int r = pakfire_format_speed(widget->buffer, sizeof(widget->buffer) - 1, p->value / t); + int r = pakfire_format_speed(widget->buffer, sizeof(widget->buffer), p->value / t); if (r < 0) return NULL; diff --git a/src/libpakfire/repo.c b/src/libpakfire/repo.c index fe70a6e6f..0bea02762 100644 --- a/src/libpakfire/repo.c +++ b/src/libpakfire/repo.c @@ -1212,7 +1212,7 @@ static int pakfire_repo_write_metadata(struct pakfire_repo* repo) { char database[PATH_MAX]; // Write the database - r = pakfire_repo_write_database(repo, path, database, sizeof(database) - 1); + r = pakfire_repo_write_database(repo, path, database, sizeof(database)); if (r) return r;