浏览代码

'\0' is a control character, no need to check it explicitly

Roberto Ierusalimschy 9 年之前
父节点
当前提交
c3e9b14d24
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      lstrlib.c

+ 2 - 2
lstrlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstrlib.c,v 1.238 2015/11/23 11:31:21 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.239 2015/11/25 16:28:17 roberto Exp roberto $
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 */
@@ -931,7 +931,7 @@ static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
       luaL_addchar(b, '\\');
       luaL_addchar(b, *s);
     }
-    else if (*s == '\0' || iscntrl(uchar(*s))) {
+    else if (iscntrl(uchar(*s))) {
       char buff[10];
       if (!isdigit(uchar(*(s+1))))
         l_sprintf(buff, sizeof(buff), "\\%d", (int)uchar(*s));