Il 30/03/2014 14:14, Norihiro Tanaka ha scritto:
-          if (beg > buf && beg[-1] != eol)
-            continue;
-          if (beg + len < buf + size && beg[len] != eol)
-            continue;
-          goto success;
+          if (beg[-1] == eol && beg[len] == eol)
+            goto success;
+          beg = memchr (beg, eol, buf + size - beg);
         }

Are we sure that beg > buf && beg + len < buf + size?

Perhaps we need

  if (beg > buf && beg[-1] == eol &&
      beg + len < buf + size && beg[len] == eol)
    goto success;

  beg = memchr (beg, eol, buf + size - beg);

Otherwise, the patch is an obvious improvement.  Thanks!

Paolo



Reply via email to