Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/mit/lua/dist/src kill sprintf
details: https://anonhg.NetBSD.org/src/rev/767fabaec169
branches: trunk
changeset: 328124:767fabaec169
user: christos <christos%NetBSD.org@localhost>
date: Wed Mar 26 22:03:26 2014 +0000
description:
kill sprintf
diffstat:
external/mit/lua/dist/src/lobject.c | 6 +++---
external/mit/lua/dist/src/lstrlib.c | 16 ++++++++--------
external/mit/lua/dist/src/luaconf.h | 4 ++--
external/mit/lua/dist/src/lvm.c | 6 +++---
4 files changed, 16 insertions(+), 16 deletions(-)
diffs (117 lines):
diff -r e8c84bbb9140 -r 767fabaec169 external/mit/lua/dist/src/lobject.c
--- a/external/mit/lua/dist/src/lobject.c Wed Mar 26 21:29:54 2014 +0000
+++ b/external/mit/lua/dist/src/lobject.c Wed Mar 26 22:03:26 2014 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: lobject.c,v 1.1.1.2 2012/03/15 00:08:09 alnsn Exp $ */
+/* $NetBSD: lobject.c,v 1.2 2014/03/26 22:03:26 christos Exp $ */
/*
-** $Id: lobject.c,v 1.1.1.2 2012/03/15 00:08:09 alnsn Exp $
+** $Id: lobject.c,v 1.2 2014/03/26 22:03:26 christos Exp $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
@@ -144,7 +144,7 @@
}
case 'p': {
char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */
- sprintf(buff, "%p", va_arg(argp, void *));
+ snprintf(buff, sizeof(buff), "%p", va_arg(argp, void *));
pushstr(L, buff);
break;
}
diff -r e8c84bbb9140 -r 767fabaec169 external/mit/lua/dist/src/lstrlib.c
--- a/external/mit/lua/dist/src/lstrlib.c Wed Mar 26 21:29:54 2014 +0000
+++ b/external/mit/lua/dist/src/lstrlib.c Wed Mar 26 22:03:26 2014 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: lstrlib.c,v 1.3 2013/12/16 23:25:56 lneto Exp $ */
+/* $NetBSD: lstrlib.c,v 1.4 2014/03/26 22:03:26 christos Exp $ */
/*
-** $Id: lstrlib.c,v 1.3 2013/12/16 23:25:56 lneto Exp $
+** $Id: lstrlib.c,v 1.4 2014/03/26 22:03:26 christos Exp $
** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h
*/
@@ -776,27 +776,27 @@
strfrmt = scanformat(L, strfrmt, form);
switch (*strfrmt++) {
case 'c': {
- sprintf(buff, form, (int)luaL_checknumber(L, arg));
+ snprintf(buff, sizeof(buff), form, (int)luaL_checknumber(L, arg));
break;
}
case 'd': case 'i': {
addintlen(form);
- sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg));
+ snprintf(buff, sizeof(buff), form, (LUA_INTFRM_T)luaL_checknumber(L, arg));
break;
}
case 'o': case 'u': case 'x': case 'X': {
addintlen(form);
#ifndef _KERNEL
- sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
+ snprintf(buff, sizeof(buff), form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
#else
- sprintf(buff, form, (LUA_UINTFRM_T)luaL_checknumber(L, arg));
+ snprintf(buff, sizeof(buff), form, (LUA_UINTFRM_T)luaL_checknumber(L, arg));
#endif
break;
}
#ifndef _KERNEL
case 'e': case 'E': case 'f':
case 'g': case 'G': {
- sprintf(buff, form, (double)luaL_checknumber(L, arg));
+ snprintf(buff, sizeof(buff), form, (double)luaL_checknumber(L, arg));
break;
}
#endif
@@ -815,7 +815,7 @@
continue; /* skip the `addsize' at the end */
}
else {
- sprintf(buff, form, s);
+ snprintf(buff, sizeof(buff), form, s);
break;
}
}
diff -r e8c84bbb9140 -r 767fabaec169 external/mit/lua/dist/src/luaconf.h
--- a/external/mit/lua/dist/src/luaconf.h Wed Mar 26 21:29:54 2014 +0000
+++ b/external/mit/lua/dist/src/luaconf.h Wed Mar 26 22:03:26 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: luaconf.h,v 1.6 2013/12/16 23:25:56 lneto Exp $ */
+/* $NetBSD: luaconf.h,v 1.7 2014/03/26 22:03:26 christos Exp $ */
/*
** Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
@@ -545,7 +545,7 @@
#define lua_str2number(s,p) strtod((s), (p))
#endif
-#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
+#define lua_number2str(s,l,n) snprintf((s), (l), LUA_NUMBER_FMT, (n))
#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
/*
diff -r e8c84bbb9140 -r 767fabaec169 external/mit/lua/dist/src/lvm.c
--- a/external/mit/lua/dist/src/lvm.c Wed Mar 26 21:29:54 2014 +0000
+++ b/external/mit/lua/dist/src/lvm.c Wed Mar 26 22:03:26 2014 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: lvm.c,v 1.1.1.2 2012/03/15 00:08:05 alnsn Exp $ */
+/* $NetBSD: lvm.c,v 1.2 2014/03/26 22:03:26 christos Exp $ */
/*
-** $Id: lvm.c,v 1.1.1.2 2012/03/15 00:08:05 alnsn Exp $
+** $Id: lvm.c,v 1.2 2014/03/26 22:03:26 christos Exp $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -52,7 +52,7 @@
else {
char s[LUAI_MAXNUMBER2STR];
lua_Number n = nvalue(obj);
- lua_number2str(s, n);
+ lua_number2str(s, sizeof(s), n);
setsvalue2s(L, obj, luaS_new(L, s));
return 1;
}
Home |
Main Index |
Thread Index |
Old Index