From 1c459b881f0bb579d63eef26acbc2be2110ae3e4 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 3 May 2004 09:30:41 -0300 Subject: accept `\r' as newline when looking for line end --- lobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lobject.c') diff --git a/lobject.c b/lobject.c index 27e9b03a..04ad92c4 100644 --- a/lobject.c +++ b/lobject.c @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 2.1 2003/12/10 12:13:36 roberto Exp roberto $ +** $Id: lobject.c,v 2.2 2004/04/30 20:13:38 roberto Exp roberto $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -173,7 +173,7 @@ void luaO_chunkid (char *out, const char *source, int bufflen) { strcat(out, source); } else { /* out = [string "string"] */ - int len = strcspn(source, "\n"); /* stop at first newline */ + int len = strcspn(source, "\n\r"); /* stop at first newline */ bufflen -= sizeof(" [string \"...\"] "); if (len > bufflen) len = bufflen; strcpy(out, "[string \""); -- cgit v1.2.3-55-g6feb