]> git.saurik.com Git - cycript.git/commitdiff
Fix line numbers of errors caused in executed scripts due to lopping off the first...
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 12 Oct 2009 00:04:11 +0000 (00:04 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 12 Oct 2009 00:04:11 +0000 (00:04 +0000)
Application.mm

index 46b24ac64b0a870b31c6b7d62e55ea43df5fc0a5..e910f66f6e221beea067f8d1722a6eec1fa434ce 100644 (file)
@@ -244,7 +244,11 @@ int main(int argc, const char *argv[]) {
 
         if (size >= 2 && start[0] == '#' && start[1] == '!') {
             start += 2;
-            while (start != end && *start++ != '\n');
+
+            if (void *line = memchr(start, '\n', end - start))
+                start = reinterpret_cast<char *>(line);
+            else
+                start = end;
         }
 
         driver.data_ = start;