From: Felipe Pena Date: Sun, 17 Nov 2013 12:23:50 +0000 (-0200) Subject: - Fix trailling newline handling X-Git-Tag: php-5.6.0alpha1~110^2~273 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=180bb579bfcae9e6a42c1c738ea66bdbb6463d19;p=php - Fix trailling newline handling --- diff --git a/phpdbg_list.c b/phpdbg_list.c index 0c61bc4a31..35de246ad0 100644 --- a/phpdbg_list.c +++ b/phpdbg_list.c @@ -179,11 +179,15 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig end_pos = mem + st.st_size; #endif while (1) { + if (pos == end_pos) { + break; + } + pos = memchr(last_pos, '\n', end_pos - last_pos); if (!pos) { /* No more line breaks */ - break; + pos = end_pos; } ++line;