svn commit: r330284 - head/stand/liblua
Kyle Evans
kevans at FreeBSD.org
Fri Mar 2 16:31:24 UTC 2018
Author: kevans
Date: Fri Mar 2 16:31:23 2018
New Revision: 330284
URL: https://svnweb.freebsd.org/changeset/base/330284
Log:
liblua: Use putc instead of printf for printc
printc does not need the features or the overhead of printf. It does not
take formatting strings, and it pipes the single string argument through an
"%s" format.
Instead, use putc directly. This pipes the string through in its entirety as
a series of 'unsigned char's, generally straight to the console emulator.
Discussed with: tsoome
Modified:
head/stand/liblua/lutils.c
Modified: head/stand/liblua/lutils.c
==============================================================================
--- head/stand/liblua/lutils.c Fri Mar 2 16:06:20 2018 (r330283)
+++ head/stand/liblua/lutils.c Fri Mar 2 16:31:23 2018 (r330284)
@@ -153,13 +153,13 @@ lua_unsetenv(lua_State *L)
static int
lua_printc(lua_State *L)
{
- int status;
- ssize_t l;
+ ssize_t cur, l;
const char *s = luaL_checklstring(L, 1, &l);
- status = (printf("%s", s) == l);
+ for (cur = 0; cur < l; ++cur)
+ putchar((unsigned char)*(s++));
- return status;
+ return 1;
}
static int
More information about the svn-src-head
mailing list