From: Matthew Fernandez Date: Sun, 6 Mar 2022 22:42:45 +0000 (-0800) Subject: epsf_emit_body: undo a 'strcmp' micro-optimization X-Git-Tag: 4.0.0~188^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=87a705e9053123cb3b7d582d19559522a2576bbd;p=graphviz epsf_emit_body: undo a 'strcmp' micro-optimization The preceding `%` checks are unnecessary to do separately. Modern compilers can do this kind of optimization themselves. --- diff --git a/lib/common/psusershape.c b/lib/common/psusershape.c index e81840e0d..116c5f34e 100644 --- a/lib/common/psusershape.c +++ b/lib/common/psusershape.c @@ -193,12 +193,8 @@ void epsf_emit_body(GVJ_t *job, usershape_t *us) p = us->data; while (*p) { /* skip %%EOF lines */ - if ((p[0] == '%') && (p[1] == '%') - && (!strncasecmp(&p[2], "EOF", 3) - || !strncasecmp(&p[2], "BEGIN", 5) - || !strncasecmp(&p[2], "END", 3) - || !strncasecmp(&p[2], "TRAILER", 7) - )) { + if (!strncasecmp(p, "%%EOF", 5) || !strncasecmp(p, "%%BEGIN", 7) || + !strncasecmp(p, "%%END", 5) || !strncasecmp(p, "%%TRAILER", 9)) { /* check for *p since last line might not end in '\n' */ while ((c = *p) && (c != '\r') && (c != '\n')) p++; if ((*p == '\r') && (*(p+1) == '\n')) p += 2;