- Fix trailling newline handling

This commit is contained in:
Felipe Pena 2013-11-17 10:23:50 -02:00
parent f51a08b6d6
commit 180bb579bf

View file

@ -179,11 +179,15 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig
end_pos = mem + st.st_size; end_pos = mem + st.st_size;
#endif #endif
while (1) { while (1) {
if (pos == end_pos) {
break;
}
pos = memchr(last_pos, '\n', end_pos - last_pos); pos = memchr(last_pos, '\n', end_pos - last_pos);
if (!pos) { if (!pos) {
/* No more line breaks */ /* No more line breaks */
break; pos = end_pos;
} }
++line; ++line;