From 50405cceb85491355923c75ae928e3e51bb14325 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 17 Dec 2022 11:53:19 -0800 Subject: [PATCH] cgraph: avoid accessing agxbuf internals in the scanner 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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/cgraph/scan.l b/lib/cgraph/scan.l index 72be9b3d0..20fbd36ae 100644 --- a/lib/cgraph/scan.l +++ b/lib/cgraph/scan.l @@ -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 : -- 2.40.0