Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jan 2018 17:56:20 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328443 - head/contrib/lua/src
Message-ID:  <201801261756.w0QHuKxT003393@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Fri Jan 26 17:56:20 2018
New Revision: 328443
URL: https://svnweb.freebsd.org/changeset/base/328443

Log:
  Gross hack to omit printing hex floating point when the lua number
  type is int64. While lua is setup for the representation, it's not
  setup to properly print the numbers as ints. This is the least-gross
  way around that, and won't affect the bootloader where we do this.

Modified:
  head/contrib/lua/src/lstrlib.c

Modified: head/contrib/lua/src/lstrlib.c
==============================================================================
--- head/contrib/lua/src/lstrlib.c	Fri Jan 26 17:55:17 2018	(r328442)
+++ head/contrib/lua/src/lstrlib.c	Fri Jan 26 17:56:20 2018	(r328443)
@@ -951,12 +951,16 @@ static void addliteral (lua_State *L, luaL_Buffer *b, 
     case LUA_TNUMBER: {
       char *buff = luaL_prepbuffsize(b, MAX_ITEM);
       int nb;
+#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64
       if (!lua_isinteger(L, arg)) {  /* float? */
         lua_Number n = lua_tonumber(L, arg);  /* write as hexa ('%a') */
         nb = lua_number2strx(L, buff, MAX_ITEM, "%" LUA_NUMBER_FRMLEN "a", n);
         checkdp(buff, nb);  /* ensure it uses a dot */
       }
       else {  /* integers */
+#else
+      {
+#endif
         lua_Integer n = lua_tointeger(L, arg);
         const char *format = (n == LUA_MININTEGER)  /* corner case? */
                            ? "0x%" LUA_INTEGER_FRMLEN "x"  /* use hexa */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801261756.w0QHuKxT003393>