]> Savannah Git Hosting - gnulib.git/commitdiff
terminfo, termcap: Fix "discards 'const' qualifier" warnings.
authorBruno Haible <bruno@clisp.org>
Sun, 4 Jun 2023 14:41:47 +0000 (16:41 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Jun 2023 14:43:34 +0000 (16:43 +0200)
* lib/tparm.c (tparm): Change type of 'fmt'. New local variable 'fmtp'.

ChangeLog
lib/tparm.c

index 83763426686c7f9d997bd82cc5fab3db3f367cf5..af117a905a1391d1533431da64ff09052a6e082e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-06-04  Bruno Haible  <bruno@clisp.org>
+
+       terminfo, termcap: Fix "discards 'const' qualifier" warnings.
+       * lib/tparm.c (tparm): Change type of 'fmt'. New local variable 'fmtp'.
+
 2023-06-04  Bruno Haible  <bruno@clisp.org>
 
        uniname/uniname: Add comments.
index e9214e292c7e66db9d64ea93b7dc5be8c17bebff..1bc7c74845a82f35802cb7c673652dd4dcf7adde 100644 (file)
@@ -260,7 +260,7 @@ tparm (const char *str, ...)
   static char buf[MAX_LINE];
   const char *sp;
   char *dp;
-  char *fmt;
+  const char *fmt;
   char scan_for;
   int scan_depth;
   int if_depth;
@@ -473,21 +473,22 @@ tparm (const char *str, ...)
             case '6': case '7': case '8': case '9':
               if (fmt == NULL)
                 {
+                  char *fmtp;
                   if (termcap)
                     return OOPS;
                   if (*sp == ':')
                     sp++;
-                  fmt = fmt_buf;
-                  *fmt++ = '%';
+                  fmtp = fmt_buf;
+                  *fmtp++ = '%';
                   while (*sp != 's' && *sp != 'x' && *sp != 'X' && *sp != 'd'
                          && *sp != 'o' && *sp != 'c' && *sp != 'u')
                     {
                       if (*sp == '\0')
                         return OOPS;
-                      *fmt++ = *sp++;
+                      *fmtp++ = *sp++;
                     }
-                  *fmt++ = *sp;
-                  *fmt = '\0';
+                  *fmtp++ = *sp;
+                  *fmtp = '\0';
                   fmt = fmt_buf;
                 }
               {