From: Michael Tremer Date: Tue, 24 Mar 2026 17:36:20 +0000 (+0000) Subject: Constify a couple of variables X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=7b52b801924b1aaad9dca1f94ccb7cc3325b44d7;p=pakfire.git Constify a couple of variables These are all from string matching where the return value will now be constified if the input argument was. Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/arch.c b/src/pakfire/arch.c index 3ba60c2f..fc534c10 100644 --- a/src/pakfire/arch.c +++ b/src/pakfire/arch.c @@ -159,7 +159,7 @@ int __pakfire_arch_buildtarget(char* buffer, size_t length, const char* arch, co int vendor_length = strlen(vendor); // Cut off suffix if it contains spaces - char* space = strchr(vendor, ' '); + const char* space = strchr(vendor, ' '); if (space) vendor_length = space - vendor; diff --git a/src/pakfire/cgroup.c b/src/pakfire/cgroup.c index 9137cc38..e991fbd8 100644 --- a/src/pakfire/cgroup.c +++ b/src/pakfire/cgroup.c @@ -430,7 +430,7 @@ static int pakfire_cgroup_create_recursive(pakfire_cgroup** cgroup, pakfire_ctx* ctx, pakfire_cgroup* parent, const char* name, int flags) { pakfire_cgroup* child = NULL; char buffer[NAME_MAX]; - char* p = NULL; + const char* p = NULL; int r; // Name cannot be empty diff --git a/src/pakfire/string.c b/src/pakfire/string.c index 0513543d..7a057fd8 100644 --- a/src/pakfire/string.c +++ b/src/pakfire/string.c @@ -188,7 +188,7 @@ void pakfire_string_truncate(char* s, const size_t l) { } int pakfire_string_partition(const char* s, const char* delim, char** s1, char** s2) { - char* p = strstr(s, delim); + const char* p = strstr(s, delim); // Delim was not found if (!p) {