summaryrefslogtreecommitdiff
path: root/nuttx/libc/string
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-01-16 08:03:26 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-01-16 08:03:26 -0600
commit9364f0d5d4690a108567a124c8c52613eb96307a (patch)
treebdad4bada0cfe9cbc7752625300351acf1f12a29 /nuttx/libc/string
parente48a37b84457b5892b204f7996e3b7ee2f9a3ad1 (diff)
downloadpx4-nuttx-9364f0d5d4690a108567a124c8c52613eb96307a.tar.gz
px4-nuttx-9364f0d5d4690a108567a124c8c52613eb96307a.tar.bz2
px4-nuttx-9364f0d5d4690a108567a124c8c52613eb96307a.zip
Move strol(), stroul(), and friends from libc/string to libc/stdlib where they belong
Diffstat (limited to 'nuttx/libc/string')
-rw-r--r--nuttx/libc/string/Make.defs18
-rw-r--r--nuttx/libc/string/lib_checkbase.c115
-rw-r--r--nuttx/libc/string/lib_strtod.c241
-rw-r--r--nuttx/libc/string/lib_strtol.c103
-rw-r--r--nuttx/libc/string/lib_strtoll.c107
-rw-r--r--nuttx/libc/string/lib_strtoul.c99
-rw-r--r--nuttx/libc/string/lib_strtoull.c100
7 files changed, 8 insertions, 775 deletions
diff --git a/nuttx/libc/string/Make.defs b/nuttx/libc/string/Make.defs
index aedbdd96b..ff0ca1f6b 100644
--- a/nuttx/libc/string/Make.defs
+++ b/nuttx/libc/string/Make.defs
@@ -1,7 +1,7 @@
############################################################################
# libc/string/Make.defs
#
-# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+# Copyright (C) 2011-2012, 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -35,15 +35,13 @@
# Add the string C files to the build
-CSRCS += lib_checkbase.c lib_isbasedigit.c lib_memset.c lib_memchr.c
-CSRCS += lib_memccpy.c lib_memcmp.c lib_memmove.c lib_skipspace.c
-CSRCS += lib_stpcpy.c lib_strcasecmp.c lib_strcat.c lib_strchr.c
-CSRCS += lib_strcpy.c lib_strcmp.c lib_strcspn.c lib_strdup.c lib_strerror.c
-CSRCS += lib_strlen.c lib_strnlen.c lib_strncasecmp.c lib_strncat.c
-CSRCS += lib_strncmp.c lib_strncpy.c lib_strndup.c lib_strcasestr.c
-CSRCS += lib_strpbrk.c lib_strrchr.c lib_strspn.c lib_strstr.c lib_strtok.c
-CSRCS += lib_strtokr.c lib_strtol.c lib_strtoll.c lib_strtoul.c
-CSRCS += lib_strtoull.c lib_strtod.c
+CSRCS += lib_isbasedigit.c lib_memset.c lib_memchr.c lib_memccpy.c
+CSRCS += lib_memcmp.c lib_memmove.c lib_skipspace.c lib_stpcpy.c
+CSRCS += lib_strcasecmp.c lib_strcat.c lib_strchr.c lib_strcpy.c
+CSRCS += lib_strcmp.c lib_strcspn.c lib_strdup.c lib_strerror.c lib_strlen.c
+CSRCS += lib_strnlen.c lib_strncasecmp.c lib_strncat.c lib_strncmp.c
+CSRCS += lib_strncpy.c lib_strndup.c lib_strcasestr.c lib_strpbrk.c
+CSRCS += lib_strrchr.c lib_strspn.c lib_strstr.c lib_strtok.c lib_strtokr.c
ifneq ($(CONFIG_ARCH_MEMCPY),y)
ifeq ($(CONFIG_MEMCPY_VIK),y)
diff --git a/nuttx/libc/string/lib_checkbase.c b/nuttx/libc/string/lib_checkbase.c
deleted file mode 100644
index 32ae58dca..000000000
--- a/nuttx/libc/string/lib_checkbase.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
- * libc/string/lib_checkbase.c
- *
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * 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.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <string.h>
-#include <ctype.h>
-
-#include "lib_internal.h"
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lib_checkbase
- *
- * Description:
- * This is part of the strol() family implementation. This function checks
- * the initial part of a string to see if it can determine the numeric
- * base that is represented.
- *
- * Assumptions:
- * *ptr points to the first, non-whitespace character in the string.
- *
- ****************************************************************************/
-
-int lib_checkbase(int base, const char **pptr)
-{
- const char *ptr = *pptr;
-
- /* Check for unspecified base */
-
- if (!base)
- {
- /* Assume base 10 */
-
- base = 10;
-
- /* Check for leading '0' - that would signify octal or hex (or binary) */
-
- if (*ptr == '0')
- {
- /* Assume octal */
-
- base = 8;
- ptr++;
-
- /* Check for hexidecimal */
-
- if ((*ptr == 'X' || *ptr == 'x') &&
- lib_isbasedigit(ptr[1], 16, NULL))
- {
- base = 16;
- ptr++;
- }
- }
- }
-
- /* If it a hexidecimal representation, than discard any leading "0X" or "0x" */
-
- else if (base == 16)
- {
- if (ptr[0] == '0' && (ptr[1] == 'X' || ptr[1] == 'x'))
- {
- ptr += 2;
- }
- }
-
- /* Return the updated pointer and base */
-
- *pptr = ptr;
- return base;
-}
-
diff --git a/nuttx/libc/string/lib_strtod.c b/nuttx/libc/string/lib_strtod.c
deleted file mode 100644
index 58dfd6a29..000000000
--- a/nuttx/libc/string/lib_strtod.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/****************************************************************************
- * libc/string/lib_strtod.c
- * Convert string to double
- *
- * Copyright (C) 2002 Michael Ringgaard. All rights reserved.
- * Copyright (C) 2006-2007 H. Peter Anvin.
- *
- * 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.
- * 3. Neither the name of the project nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/compiler.h>
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <errno.h>
-
-#ifdef CONFIG_HAVE_DOUBLE
-
-/****************************************************************************
- * Pre-processor definitions
- ****************************************************************************/
-
-/* These are predefined with GCC, but could be issues for other compilers. If
- * not defined, an arbitrary big number is put in for now. These should be
- * added to nuttx/compiler for your compiler.
- */
-
-#if !defined(__DBL_MIN_EXP__) || !defined(__DBL_MAX_EXP__)
-# ifdef CONFIG_CPP_HAVE_WARNING
-# warning "Size of exponent is unknown"
-# endif
-# undef __DBL_MIN_EXP__
-# define __DBL_MIN_EXP__ (-1021)
-# undef __DBL_MAX_EXP__
-# define __DBL_MAX_EXP__ (1024)
-#endif
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-static inline int is_real(double x)
-{
- const double_t infinite = 1.0/0.0;
- return (x < infinite) && (x >= -infinite);
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/***************************************************(************************
- * Name: strtod
- *
- * Description:
- * Convert a string to a double value
- *
- ****************************************************************************/
-
-double_t strtod(const char *str, char **endptr)
-{
- double_t number;
- int exponent;
- int negative;
- char *p = (char *) str;
- double p10;
- int n;
- int num_digits;
- int num_decimals;
- const double_t infinite = 1.0/0.0;
-
- /* Skip leading whitespace */
-
- while (isspace(*p))
- {
- p++;
- }
-
- /* Handle optional sign */
-
- negative = 0;
- switch (*p)
- {
- case '-':
- negative = 1; /* Fall through to increment position */
- case '+':
- p++;
- }
-
- number = 0.;
- exponent = 0;
- num_digits = 0;
- num_decimals = 0;
-
- /* Process string of digits */
-
- while (isdigit(*p))
- {
- number = number * 10. + (*p - '0');
- p++;
- num_digits++;
- }
-
- /* Process decimal part */
-
- if (*p == '.')
- {
- p++;
-
- while (isdigit(*p))
- {
- number = number * 10. + (*p - '0');
- p++;
- num_digits++;
- num_decimals++;
- }
-
- exponent -= num_decimals;
- }
-
- if (num_digits == 0)
- {
- set_errno(ERANGE);
- return 0.0;
- }
-
- /* Correct for sign */
-
- if (negative)
- {
- number = -number;
- }
-
- /* Process an exponent string */
-
- if (*p == 'e' || *p == 'E')
- {
- /* Handle optional sign */
-
- negative = 0;
- switch(*++p)
- {
- case '-':
- negative = 1; /* Fall through to increment pos */
- case '+':
- p++;
- }
-
- /* Process string of digits */
-
- n = 0;
- while (isdigit(*p))
- {
- n = n * 10 + (*p - '0');
- p++;
- }
-
- if (negative)
- {
- exponent -= n;
- }
- else
- {
- exponent += n;
- }
- }
-
- if (exponent < __DBL_MIN_EXP__ ||
- exponent > __DBL_MAX_EXP__)
- {
- set_errno(ERANGE);
- return infinite;
- }
-
- /* Scale the result */
-
- p10 = 10.;
- n = exponent;
- if (n < 0) n = -n;
- while (n)
- {
- if (n & 1)
- {
- if (exponent < 0)
- {
- number /= p10;
- }
- else
- {
- number *= p10;
- }
- }
- n >>= 1;
- p10 *= p10;
- }
-
- if (!is_real(number))
- {
- set_errno(ERANGE);
- }
-
- if (endptr)
- {
- *endptr = p;
- }
-
- return number;
-}
-
-#endif /* CONFIG_HAVE_DOUBLE */
-
diff --git a/nuttx/libc/string/lib_strtol.c b/nuttx/libc/string/lib_strtol.c
deleted file mode 100644
index 6ac0d6827..000000000
--- a/nuttx/libc/string/lib_strtol.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
- * libc/string/lib_strtol.c
- *
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * 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.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdbool.h>
-#include <stdlib.h>
-
-#include "lib_internal.h"
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strtol
- *
- * Description:
- * The strtol() function converts the initial part of the string in
- * nptr to a long integer value according to the given base, which must be
- * between 2 and 36 inclusive, or be the special value 0.
- *
- * Warning: does not check for integer overflow!
- *
- ****************************************************************************/
-
-long strtol(const char *nptr, char **endptr, int base)
-{
- unsigned long accum = 0;
- bool negate = false;
-
- if (nptr)
- {
- /* Skip leading spaces */
-
- lib_skipspace(&nptr);
-
- /* Check for leading + or - */
-
- if (*nptr == '-')
- {
- negate = true;
- nptr++;
- }
- else if (*nptr == '+')
- {
- nptr++;
- }
-
- /* Get the unsigned value */
-
- accum = strtoul(nptr, endptr, base);
-
- /* Correct the sign of the result */
-
- if (negate)
- {
- return -(long)accum;
- }
- }
- return (long)accum;
-}
-
diff --git a/nuttx/libc/string/lib_strtoll.c b/nuttx/libc/string/lib_strtoll.c
deleted file mode 100644
index 99fba08eb..000000000
--- a/nuttx/libc/string/lib_strtoll.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
- * libc/string/lib_strtoll.c
- *
- * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * 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.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdbool.h>
-#include <stdlib.h>
-
-#include "lib_internal.h"
-
-#ifdef CONFIG_HAVE_LONG_LONG
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strtoll
- *
- * Description:
- * The strtol() function converts the initial part of the string in
- * nptr to a long long integer value according to the given base, which
- * must be between 2 and 36 inclusive, or be the special value 0.
- *
- * Warning: does not check for integer overflow!
- *
- ****************************************************************************/
-
-long long strtoll(const char *nptr, char **endptr, int base)
-{
- unsigned long long accum = 0;
- bool negate = false;
-
- if (nptr)
- {
- /* Skip leading spaces */
-
- lib_skipspace(&nptr);
-
- /* Check for leading + or - */
-
- if (*nptr == '-')
- {
- negate = true;
- nptr++;
- }
- else if (*nptr == '+')
- {
- nptr++;
- }
-
- /* Get the unsigned value */
-
- accum = strtoull(nptr, endptr, base);
-
- /* Correct the sign of the result */
-
- if (negate)
- {
- return -(long long)accum;
- }
- }
- return (long long)accum;
-}
-
-#endif
-
diff --git a/nuttx/libc/string/lib_strtoul.c b/nuttx/libc/string/lib_strtoul.c
deleted file mode 100644
index 62a768043..000000000
--- a/nuttx/libc/string/lib_strtoul.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
- * /libc/string/lib_strtoul.c
- *
- * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * 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.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdlib.h>
-
-#include "lib_internal.h"
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strtoul
- *
- * Description:
- * The strtol() function converts the initial part of the string in
- * nptr to a long unsigned integer value according to the given base, which
- * must be between 2 and 36 inclusive, or be the special value 0.
- *
- * Warning: does not check for integer overflow!
- *
- ****************************************************************************/
-
-unsigned long strtoul(const char *nptr, char **endptr, int base)
-{
- unsigned long accum = 0;
- int value;
-
- if (nptr)
- {
- /* Skip leading spaces */
-
- lib_skipspace(&nptr);
-
- /* Check for unspecified base */
-
- base = lib_checkbase(base, &nptr);
-
- /* Accumulate each "digit" */
-
- while (lib_isbasedigit(*nptr, base, &value))
- {
- accum = accum*base + value;
- nptr++;
- }
-
- /* Return the final pointer to the unused value */
-
- if (endptr)
- {
- *endptr = (char *)nptr;
- }
- }
-
- return accum;
-}
-
diff --git a/nuttx/libc/string/lib_strtoull.c b/nuttx/libc/string/lib_strtoull.c
deleted file mode 100644
index 4808114af..000000000
--- a/nuttx/libc/string/lib_strtoull.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
- * /libc/string/lib_strtoull.c
- *
- * Copyright (C) 2009, 2010 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * 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.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/compiler.h>
-
-#include <stdlib.h>
-
-#include "lib_internal.h"
-
-#ifdef CONFIG_HAVE_LONG_LONG
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: strtoull
- *
- * Description:
- * The strtol() function converts the initial part of the string in
- * nptr to a long unsigned integer value according to the given base, which
- * must be between 2 and 36 inclusive, or be the special value 0.
- *
- ****************************************************************************/
-
-unsigned long long strtoull(const char *nptr, char **endptr, int base)
-{
- unsigned long long accum = 0;
- int value;
-
- if (nptr)
- {
- /* Skip leading spaces */
-
- lib_skipspace(&nptr);
-
- /* Check for unspecified base */
-
- base = lib_checkbase(base, &nptr);
-
- /* Accumulate each "digit" */
-
- while (lib_isbasedigit(*nptr, base, &value))
- {
- accum = accum*base + value;
- nptr++;
- }
-
- /* Return the final pointer to the unused value */
-
- if (endptr)
- {
- *endptr = (char *)nptr;
- }
- }
- return accum;
-}
-#endif
-