]> granicus.if.org Git - graphviz/commitdiff
ast stresc: remove return value
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 24 Jul 2022 17:05:08 +0000 (10:05 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 30 Jul 2022 00:02:13 +0000 (17:02 -0700)
The computation of the return value for this function was relying on string
lengths that fitted in an `int`, something that is generally but not always
true. The compiler complained about this with -Wconversion. The only caller of
this function does not use the return value, so lets just remove it.

lib/ast/ast.h
lib/ast/stresc.c

index d53760a001e9701950eb8d48acccd79d03253601..bbbdce44fb39adc2881b2641f6e0df57520290ea 100644 (file)
@@ -75,7 +75,7 @@ extern "C" {
 
     extern int strmatch(const char *, const char *);
     extern int strgrpmatch(const char *, const char *, int *, int, int);
-    extern int stresc(char *);
+    extern void stresc(char *);
     extern char *strcopy(char *s, const char *t);
 
 #ifdef __cplusplus
index 0d8be317b03af7f39d73bcfd1ce0a37bcf16ad25..75c2d118dd4687d764f0133d289d81ae8e82d9c2 100644 (file)
  * AT&T Bell Laboratories
  *
  * convert \x character constants in s in place
- * the length of the converted s is returned (may have imbedded \0's)
  */
 
 #include <ast/ast.h>
 
-int stresc(char *s)
+void stresc(char *s)
 {
     char *t;
     int c;
-    char *b;
     char *p;
 
-    b = t = s;
+    t = s;
     for (;;) {
        switch (c = *s++) {
        case '\\':
@@ -34,7 +32,7 @@ int stresc(char *s)
            break;
        case 0:
            *t = 0;
-           return (t - b);
+           return;
        }
        *t++ = c;
     }