aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-12-27 15:33:22 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-12-27 15:33:22 -0200
commitacdb0b741e31adebfa4f608f8bf23e65fa68d741 (patch)
treea4f3bb695c4b2ae03ef8e02d15953bc12de25a9d /lauxlib.c
parent5b08fcd5a1392a7440cae91e68f350a44b136806 (diff)
downloadlua-acdb0b741e31adebfa4f608f8bf23e65fa68d741.tar.gz
lua-acdb0b741e31adebfa4f608f8bf23e65fa68d741.tar.bz2
lua-acdb0b741e31adebfa4f608f8bf23e65fa68d741.zip
comments.
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 5a333d3e..78be8bef 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.21 1999/11/22 13:12:07 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.22 1999/12/20 13:09:45 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -9,7 +9,7 @@
9#include <stdio.h> 9#include <stdio.h>
10#include <string.h> 10#include <string.h>
11 11
12/* Please Notice: This file uses only the official API of Lua 12/* This file uses only the official API of Lua.
13** Any function declared here could be written as an application function. 13** Any function declared here could be written as an application function.
14** With care, these functions can be used by other libraries. 14** With care, these functions can be used by other libraries.
15*/ 15*/
@@ -113,7 +113,7 @@ void luaL_verror (lua_State *L, const char *fmt, ...) {
113} 113}
114 114
115 115
116#define EXTRALEN 13 /* > strlen('string "..."\0') */ 116#define EXTRALEN sizeof("string \"...\"0")
117 117
118void luaL_chunkid (char *out, const char *source, int len) { 118void luaL_chunkid (char *out, const char *source, int len) {
119 if (*source == '(') { 119 if (*source == '(') {
@@ -129,7 +129,7 @@ void luaL_chunkid (char *out, const char *source, int len) {
129 const char *b = strchr(source , '\n'); /* stop at first new line */ 129 const char *b = strchr(source , '\n'); /* stop at first new line */
130 int lim = (b && (b-source)<len) ? b-source : len; 130 int lim = (b && (b-source)<len) ? b-source : len;
131 sprintf(out, "string \"%.*s\"", lim, source); 131 sprintf(out, "string \"%.*s\"", lim, source);
132 strcpy(out+lim+(EXTRALEN-5), "...\""); /* 5 = strlen("...'\0") */ 132 strcpy(out+lim+(EXTRALEN-sizeof("...\"0")), "...\"");
133 } 133 }
134 } 134 }
135} 135}