Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src changed lua_Number to int64_t



details:   https://anonhg.NetBSD.org/src/rev/0e884a1a9161
branches:  trunk
changeset: 325052:0e884a1a9161
user:      lneto <lneto%NetBSD.org@localhost>
date:      Mon Dec 02 04:39:10 2013 +0000

description:
changed lua_Number to int64_t

diffstat:

 common/lib/libc/stdlib/strtoimax.c |  68 ++++++++++++++++++++++++++++++++++++++
 lib/libc/stdlib/Makefile.inc       |   3 +-
 lib/libc/stdlib/strtoimax.c        |  53 -----------------------------
 sys/lib/libkern/Makefile.libkern   |   4 +-
 sys/lib/libkern/libkern.h          |   3 +-
 sys/modules/lua/Makefile           |   5 +-
 sys/modules/lua/luaconf.h          |  11 ++---
 7 files changed, 81 insertions(+), 66 deletions(-)

diffs (232 lines):

diff -r 70e492637902 -r 0e884a1a9161 common/lib/libc/stdlib/strtoimax.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/common/lib/libc/stdlib/strtoimax.c        Mon Dec 02 04:39:10 2013 +0000
@@ -0,0 +1,68 @@
+/* $DragonFly: src/lib/libc/stdlib/strtoimax.c,v 1.2 2008/08/19 15:50:24 joerg Exp $ */
+
+/*-
+ * Copyright (c) 2005 The DragonFly Project.  All rights reserved.
+ * Copyright (c) 2003 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: strtoimax.c,v 1.1 2013/12/02 04:39:10 lneto Exp $");
+
+#ifdef _LIBC
+#include "namespace.h"
+#endif
+
+#if defined(_KERNEL)
+#include <sys/param.h>
+#include <lib/libkern/libkern.h>
+#elif defined(_STANDALONE)
+#include <sys/param.h>
+#include <lib/libkern/libkern.h>
+#include <lib/libsa/stand.h>
+#else
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdlib.h>
+#endif
+
+#define        _FUNCNAME       strtoimax
+#define        __INT           intmax_t
+#define        __INT_MIN       INTMAX_MIN
+#define        __INT_MAX       INTMAX_MAX
+
+#include "_strtol.h"
+
+#ifdef _LIBC
+__weak_alias(_strtoimax, strtoimax)
+__weak_alias(_strtoimax_l, strtoimax_l)
+#endif
diff -r 70e492637902 -r 0e884a1a9161 lib/libc/stdlib/Makefile.inc
--- a/lib/libc/stdlib/Makefile.inc      Sun Dec 01 21:48:33 2013 +0000
+++ b/lib/libc/stdlib/Makefile.inc      Mon Dec 02 04:39:10 2013 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.79 2013/04/26 18:29:55 christos Exp $
+#      $NetBSD: Makefile.inc,v 1.80 2013/12/02 04:39:10 lneto Exp $
 #      from: @(#)Makefile.inc  8.3 (Berkeley) 2/4/95
 
 # stdlib sources
@@ -30,7 +30,6 @@
 SRCS+= malloc.c
 .endif
 
-CPPFLAGS.strtoimax.c+= -I${LIBCDIR}/../../common/lib/libc/stdlib
 CPPFLAGS.strtol.c+=    -I${LIBCDIR}/../../common/lib/libc/stdlib
 CPPFLAGS.strtoq.c+=    -I${LIBCDIR}/../../common/lib/libc/stdlib
 CPPFLAGS.strtouq.c+=   -I${LIBCDIR}/../../common/lib/libc/stdlib
diff -r 70e492637902 -r 0e884a1a9161 lib/libc/stdlib/strtoimax.c
--- a/lib/libc/stdlib/strtoimax.c       Sun Dec 01 21:48:33 2013 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* $DragonFly: src/lib/libc/stdlib/strtoimax.c,v 1.2 2008/08/19 15:50:24 joerg Exp $ */
-
-/*-
- * Copyright (c) 2005 The DragonFly Project.  All rights reserved.
- * Copyright (c) 2003 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: strtoimax.c,v 1.8 2013/04/16 21:44:08 joerg Exp $");
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define        _FUNCNAME       strtoimax
-#define        __INT           intmax_t
-#define        __INT_MIN       INTMAX_MIN
-#define        __INT_MAX       INTMAX_MAX
-
-#include "_strtol.h"
-
-__strong_alias(_strtoimax, strtoimax)
-__strong_alias(_strtoimax_l, strtoimax_l)
diff -r 70e492637902 -r 0e884a1a9161 sys/lib/libkern/Makefile.libkern
--- a/sys/lib/libkern/Makefile.libkern  Sun Dec 01 21:48:33 2013 +0000
+++ b/sys/lib/libkern/Makefile.libkern  Mon Dec 02 04:39:10 2013 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.libkern,v 1.26 2013/07/23 14:52:07 skrll Exp $
+#      $NetBSD: Makefile.libkern,v 1.27 2013/12/02 04:39:10 lneto Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -80,7 +80,7 @@
 .endif
 
 SRCS+= popcount32.c popcount64.c
-SRCS+= strtoul.c strtoll.c strtoull.c strtoumax.c
+SRCS+= strtoul.c strtoll.c strtoull.c strtoimax.c strtoumax.c
 
 SRCS+= scanc.c skpc.c
 SRCS+= random.c
diff -r 70e492637902 -r 0e884a1a9161 sys/lib/libkern/libkern.h
--- a/sys/lib/libkern/libkern.h Sun Dec 01 21:48:33 2013 +0000
+++ b/sys/lib/libkern/libkern.h Mon Dec 02 04:39:10 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: libkern.h,v 1.108 2013/08/28 16:20:38 riastradh Exp $  */
+/*     $NetBSD: libkern.h,v 1.109 2013/12/02 04:39:10 lneto Exp $      */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -334,6 +334,7 @@
 u_long  strtoul(const char *, char **, int);
 long long strtoll(const char *, char **, int);
 unsigned long long strtoull(const char *, char **, int);
+intmax_t  strtoimax(const char *, char **, int);
 uintmax_t strtoumax(const char *, char **, int);
 int     snprintb(char *, size_t, const char *, uint64_t);
 int     snprintb_m(char *, size_t, const char *, uint64_t, size_t);
diff -r 70e492637902 -r 0e884a1a9161 sys/modules/lua/Makefile
--- a/sys/modules/lua/Makefile  Sun Dec 01 21:48:33 2013 +0000
+++ b/sys/modules/lua/Makefile  Mon Dec 02 04:39:10 2013 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.2 2013/10/31 16:50:14 mbalmer Exp $
+#      $NetBSD: Makefile,v 1.3 2013/12/02 04:39:10 lneto Exp $
 
 .include "../Makefile.inc"
 
@@ -44,6 +44,7 @@
 
 CFLAGS+=       -include ${.CURDIR}/luaconf.h
 
-CPPFLAGS+=     -I${S}/../external/mit/lua/dist/src
+CPPFLAGS+=     -I${S}/../external/mit/lua/dist/src \
+               -I${S}/sys
 
 .include <bsd.kmodule.mk>
diff -r 70e492637902 -r 0e884a1a9161 sys/modules/lua/luaconf.h
--- a/sys/modules/lua/luaconf.h Sun Dec 01 21:48:33 2013 +0000
+++ b/sys/modules/lua/luaconf.h Mon Dec 02 04:39:10 2013 +0000
@@ -1,5 +1,5 @@
 /*
-** $Id: luaconf.h,v 1.1 2013/10/16 19:44:57 mbalmer Exp $
+** $Id: luaconf.h,v 1.2 2013/12/02 04:39:10 lneto Exp $
 ** Configuration file for Lua
 ** See Copyright Notice in lua.h
 */
@@ -505,8 +505,7 @@
 */
 
 #ifdef _KERNEL
-#define LUA_NUMBER     long long
-
+#define LUA_NUMBER     int64_t
 #else
 #define LUA_NUMBER_DOUBLE
 #define LUA_NUMBER     double
@@ -528,9 +527,9 @@
 */
 
 #ifdef _KERNEL
-#define LUA_NUMBER_SCAN                "%lld"
-#define LUA_NUMBER_FMT         "%lld"
-#define lua_str2number(s,p)    strtoll((s), (p), 10)
+#define LUA_NUMBER_SCAN                "%" SCNd64
+#define LUA_NUMBER_FMT         "%" PRId64
+#define lua_str2number(s,p)    ((int64_t) strtoimax((s), (p), 10))
 #else
 #define LUA_NUMBER_SCAN                "%lf"
 #define LUA_NUMBER_FMT         "%.14g"



Home | Main Index | Thread Index | Old Index