Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Restore standalone strtol/strtoul for citrus for now.
details: https://anonhg.NetBSD.org/src/rev/4724adbc8474
branches: trunk
changeset: 786344:4724adbc8474
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Apr 26 21:20:47 2013 +0000
description:
Restore standalone strtol/strtoul for citrus for now.
diffstat:
common/lib/libc/stdlib/_strtol.h | 10 ++++++----
common/lib/libc/stdlib/_strtoul.h | 11 +++++++----
lib/libc/citrus/citrus_bcs_strtol.c | 33 ++++++++++++++++++++++-----------
lib/libc/citrus/citrus_bcs_strtoul.c | 32 +++++++++++++++++++++-----------
4 files changed, 56 insertions(+), 30 deletions(-)
diffs (178 lines):
diff -r 97f466480594 -r 4724adbc8474 common/lib/libc/stdlib/_strtol.h
--- a/common/lib/libc/stdlib/_strtol.h Fri Apr 26 20:57:48 2013 +0000
+++ b/common/lib/libc/stdlib/_strtol.h Fri Apr 26 21:20:47 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: _strtol.h,v 1.5 2013/04/16 21:44:06 joerg Exp $ */
+/* $NetBSD: _strtol.h,v 1.6 2013/04/26 21:20:48 joerg Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,7 +41,7 @@
* __INT_MIN : lower limit of the return type
* __INT_MAX : upper limit of the return type
*/
-#if defined(_KERNEL) || defined(_STANDALONE) || defined(HAVE_NBTOOL_CONFIG_H)
+#if defined(_KERNEL) || defined(_STANDALONE) || defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY)
__INT
_FUNCNAME(const char *nptr, char **endptr, int base)
#else
@@ -82,7 +82,8 @@
* assume decimal; if base is already 16, allow 0x.
*/
s = nptr;
-#if defined(_KERNEL) || defined(_STANDALONE) || defined(HAVE_NBTOOL_CONFIG_H)
+#if defined(_KERNEL) || defined(_STANDALONE) || \
+ defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY)
do {
c = *s++;
} while (isspace(c));
@@ -186,7 +187,8 @@
return(acc);
}
-#if !defined(_KERNEL) && !defined(_STANDALONE) && !defined(HAVE_NBTOOL_CONFIG_H)
+#if !defined(_KERNEL) && !defined(_STANDALONE) && \
+ !defined(HAVE_NBTOOL_CONFIG_H) && !defined(BCS_ONLY)
__INT
_FUNCNAME(const char *nptr, char **endptr, int base)
{
diff -r 97f466480594 -r 4724adbc8474 common/lib/libc/stdlib/_strtoul.h
--- a/common/lib/libc/stdlib/_strtoul.h Fri Apr 26 20:57:48 2013 +0000
+++ b/common/lib/libc/stdlib/_strtoul.h Fri Apr 26 21:20:47 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: _strtoul.h,v 1.5 2013/04/16 21:44:06 joerg Exp $ */
+/* $NetBSD: _strtoul.h,v 1.6 2013/04/26 21:20:48 joerg Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -40,7 +40,8 @@
* __UINT : return type
* __UINT_MAX : upper limit of the return type
*/
-#if defined(_KERNEL) || defined(_STANDALONE) || defined(HAVE_NBTOOL_CONFIG_H)
+#if defined(_KERNEL) || defined(_STANDALONE) || \
+ defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY)
__UINT
_FUNCNAME(const char *nptr, char **endptr, int base)
#else
@@ -78,7 +79,8 @@
* assume decimal; if base is already 16, allow 0x.
*/
s = nptr;
-#if defined(_KERNEL) || defined(_STANDALONE) || defined(HAVE_NBTOOL_CONFIG_H)
+#if defined(_KERNEL) || defined(_STANDALONE) || \
+ defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY)
do {
c = *s++;
} while (isspace(c));
@@ -145,7 +147,8 @@
return(acc);
}
-#if !defined(_KERNEL) && !defined(_STANDALONE) && !defined(HAVE_NBTOOL_CONFIG_H)
+#if !defined(_KERNEL) && !defined(_STANDALONE) && \
+ !defined(HAVE_NBTOOL_CONFIG_H) && !defined(BCS_ONLY)
__UINT
_FUNCNAME(const char *nptr, char **endptr, int base)
{
diff -r 97f466480594 -r 4724adbc8474 lib/libc/citrus/citrus_bcs_strtol.c
--- a/lib/libc/citrus/citrus_bcs_strtol.c Fri Apr 26 20:57:48 2013 +0000
+++ b/lib/libc/citrus/citrus_bcs_strtol.c Fri Apr 26 21:20:47 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_bcs_strtol.c,v 1.3 2013/04/16 21:44:07 joerg Exp $ */
+/* $NetBSD: citrus_bcs_strtol.c,v 1.4 2013/04/26 21:20:47 joerg Exp $ */
/*-
* Copyright (c) 2005 The DragonFly Project. All rights reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: citrus_bcs_strtol.c,v 1.3 2013/04/16 21:44:07 joerg Exp $");
+__RCSID("$NetBSD: citrus_bcs_strtol.c,v 1.4 2013/04/26 21:20:47 joerg Exp $");
#include <assert.h>
#include <errno.h>
@@ -39,12 +39,23 @@
#include "citrus_namespace.h"
#include "citrus_bcs.h"
-long int
-_bcs_strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
-{
-#if defined(HAVE_NBTOOL_CONFIG_H)
- return strtol(nptr, endptr, base);
-#else
- return strtol_l(nptr, endptr, base, 0);
-#endif
-}
+#define BCS_ONLY
+
+#define _FUNCNAME _bcs_strtol
+#define __INT long int
+#define __INT_MIN LONG_MIN
+#define __INT_MAX LONG_MAX
+
+#undef isspace
+#define isspace(c) _bcs_isspace(c)
+
+#undef isdigit
+#define isdigit(c) _bcs_isdigit(c)
+
+#undef isalpha
+#define isalpha(c) _bcs_isalpha(c)
+
+#undef isupper
+#define isupper(c) _bcs_isupper(c)
+
+#include "_strtol.h"
diff -r 97f466480594 -r 4724adbc8474 lib/libc/citrus/citrus_bcs_strtoul.c
--- a/lib/libc/citrus/citrus_bcs_strtoul.c Fri Apr 26 20:57:48 2013 +0000
+++ b/lib/libc/citrus/citrus_bcs_strtoul.c Fri Apr 26 21:20:47 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_bcs_strtoul.c,v 1.4 2013/04/16 21:44:07 joerg Exp $ */
+/* $NetBSD: citrus_bcs_strtoul.c,v 1.5 2013/04/26 21:20:48 joerg Exp $ */
/*-
* Copyright (c) 2005 The DragonFly Project. All rights reserved.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: citrus_bcs_strtoul.c,v 1.4 2013/04/16 21:44:07 joerg Exp $");
+__RCSID("$NetBSD: citrus_bcs_strtoul.c,v 1.5 2013/04/26 21:20:48 joerg Exp $");
#endif /* not lint */
#include <assert.h>
@@ -45,12 +45,22 @@
#include "citrus_namespace.h"
#include "citrus_bcs.h"
-unsigned long int
-_bcs_strtoul(const char * __restrict nptr, char ** __restrict endptr, int base)
-{
-#if defined(HAVE_NBTOOL_CONFIG_H)
- return strtoul(nptr, endptr, base);
-#else
- return strtoul_l(nptr, endptr, base, 0);
-#endif
-}
+#define BCS_ONLY
+
+#define _FUNCNAME _bcs_strtoul
+#define __UINT unsigned long int
+#define __UINT_MAX ULONG_MAX
+
+#undef isspace
+#define isspace(c) _bcs_isspace(c)
+
+#undef isdigit
+#define isdigit(c) _bcs_isdigit(c)
+
+#undef isalpha
+#define isalpha(c) _bcs_isalpha(c)
+
+#undef isupper
+#define isupper(c) _bcs_isupper(c)
+
+#include "_strtoul.h"
Home |
Main Index |
Thread Index |
Old Index