]> git.ipfire.org Git - pakfire.git/commitdiff
Remove unnecessary use of sizeof(x) - 1
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 18 Aug 2022 19:43:41 +0000 (19:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 18 Aug 2022 19:43:41 +0000 (19:43 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/pakfire.h
src/libpakfire/include/pakfire/string.h
src/libpakfire/progressbar.c
src/libpakfire/repo.c

index e626affaeeb37518037ba5cb2b05c4a316c5d5b6..a0be568c86bf8968ca2290af7fa73a324fb553bf 100644 (file)
@@ -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)));
index 43ab71095e6d33c849f741e9d83fd25a31180cc5..510217ba2b8fdd50ce59581d0aea9a538a6ace36 100644 (file)
@@ -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);
 
index ce9211c22a3072cab0b4e194bb4bc6f09789d048..9ff9adb7baf6faac218f7779e504a092ebf45001 100644 (file)
@@ -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;
 
index fe70a6e6f34902ac41d75601f2058f697faca058..0bea02762f2735648879c7500d42aa7a30c04383 100644 (file)
@@ -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;