]> granicus.if.org Git - graphviz/commitdiff
cgraph: avoid accessing agxbuf internals in the scanner
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 17 Dec 2022 19:53:19 +0000 (11:53 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 21 Dec 2022 02:54:30 +0000 (18:54 -0800)
This eases some upcoming changes to the internal structure of the `agxbuf` type.
The trailing calls to `agxbclear` are removed because they are no longer
necessary; the `agxbuse` call does the same thing.

Gitlab: #2302

lib/cgraph/scan.l

index 72be9b3d09c4844f4b8495168b2f670fa63f79c6..20fbd36ae2f603a85581b1209853fdc96fe5d2a5 100644 (file)
@@ -237,9 +237,8 @@ void aagerror(const char *str)
                if (len > 0) {
                        if (len > 80)
                                len = 80;
-                       agxbprint(&xb, "\nString starting:\"%.*s", (int)len, Sbuf.buf);
+                       agxbprint(&xb, "\nString starting:\"%.*s", (int)len, agxbuse(&Sbuf));
                }
-               agxbclear(&Sbuf);
                break;
        }
        case hstring: {
@@ -248,9 +247,8 @@ void aagerror(const char *str)
                if (len > 0) {
                        if (len > 80)
                                len = 80;
-                       agxbprint(&xb, "\nString starting:<%.*s", (int)len, Sbuf.buf);
+                       agxbprint(&xb, "\nString starting:<%.*s", (int)len, agxbuse(&Sbuf));
                }
-               agxbclear(&Sbuf);
                break;
        }
        case comment :