On 6/4/06, Linus Torvalds <torvalds@xxxxxxxx> wrote: +static unsigned long autodetect_crlf(unsigned char *src, unsigned long size)
+{ + unsigned long newsize = 0; + unsigned char *dst = src; + unsigned char last = 0; + + while (size) { + unsigned char c = *src++;
size--; is missing
+ if (last == '\r' && c == '\n') { + dst[-1] = '\n'; + } else { + newsize++; + dst++; + if (dst != src) + dst[-1] = c; + } + last = c; + } + return newsize; +}
Yakov - : send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html