commit:     0d7f869e471ec204b7f0fb6fc26ccfee712f213e
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 27 08:30:33 2026 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jan 27 08:30:33 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=0d7f869e

*: handle const qualifier discarding warnings

The code really isn't setup properly to use const when it should/could,
so it's a mix and match of a lot.  So try to fix it properly when we
can, or just add blunt casts to let the compiler know our intention is
to ignore const-ness.

Bug: https://bugs.gentoo.org/969252
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/tree.c | 2 +-
 main.c      | 2 +-
 qkeyword.c  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libq/tree.c b/libq/tree.c
index a01499b5..e6f6f3d8 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -1087,7 +1087,7 @@ static bool tree_pkg_binpkg_read
 
       while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
         const char *pathname = archive_entry_pathname(entry);
-        char       *fname    = strchr(pathname, '/');
+        char       *fname    = (char *)strchr(pathname, '/');
         if (fname == NULL)
           continue;
         fname++;

diff --git a/main.c b/main.c
index 7a581898..33b7d30c 100644
--- a/main.c
+++ b/main.c
@@ -499,7 +499,7 @@ read_portage_file(const char *file, enum portage_file_type 
type, void *data)
                                        /* handle relative paths */
                                        size_t file_path_len;
 
-                                       s = strrchr(file, '/');
+                                       s = (char *)strrchr(file, '/');
                                        file_path_len = s - file + 1;
 
                                        snprintf(npath, sizeof(npath), 
"%.*s/%s",

diff --git a/qkeyword.c b/qkeyword.c
index 1d362c05..63d2d6e6 100644
--- a/qkeyword.c
+++ b/qkeyword.c
@@ -710,8 +710,8 @@ keyword_sort(const void *l, const void *r)
 {
        const char **ls = (const char **)l;
        const char **rs = (const char **)r;
-       char *ld = strchr(*ls, '-');
-       char *rd = strchr(*rs, '-');
+       const char *ld  = strchr(*ls, '-');
+       const char *rd  = strchr(*rs, '-');
 
        if (ld == NULL && rd != NULL)
                return -1;

Reply via email to