Move strol(), stroul(), and friends from libc/string to libc/stdlib where they belong

This commit is contained in:
Gregory Nutt 2014-01-16 08:03:26 -06:00
parent b15528e429
commit be14ee1f95
9 changed files with 26 additions and 22 deletions

View File

@ -6466,3 +6466,5 @@
concern now that up_disable_irq() works is that there may now be
unmasked bugs that leave devices in the disabled state? Thanks to
Manuel Stühn for the tip(2014-1-15).
* libc: Move strtol(), strtoll, strtoul(), strtoull(), and strtod() from
libc/string to libc/stdlib where they belong (2014-1-16).

View File

@ -35,8 +35,10 @@
# Add the stdlib C files to the build
CSRCS += lib_abs.c lib_abort.c lib_imaxabs.c lib_itoa.c lib_labs.c \
lib_llabs.c lib_rand.c lib_qsort.c
CSRCS += lib_abs.c lib_abort.c lib_imaxabs.c lib_itoa.c lib_labs.c
CSRCS += lib_llabs.c lib_rand.c lib_qsort.c
CSRCS += lib_strtol.c lib_strtoll.c lib_strtoul.c lib_strtoull.c
CSRCS += lib_strtod.c lib_checkbase.c
# Add the stdlib directory to the build

View File

@ -1,5 +1,5 @@
/****************************************************************************
* libc/string/lib_checkbase.c
* libc/stdlib/lib_checkbase.c
*
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -65,7 +65,7 @@
*
****************************************************************************/
int lib_checkbase(int base, const char **pptr)
int lib_checkbase(int base, FAR const char **pptr)
{
const char *ptr = *pptr;
@ -86,7 +86,7 @@ int lib_checkbase(int base, const char **pptr)
base = 8;
ptr++;
/* Check for hexidecimal */
/* Check for hexadecimal */
if ((*ptr == 'X' || *ptr == 'x') &&
lib_isbasedigit(ptr[1], 16, NULL))
@ -97,7 +97,7 @@ int lib_checkbase(int base, const char **pptr)
}
}
/* If it a hexidecimal representation, than discard any leading "0X" or "0x" */
/* If it a hexadecimal representation, than discard any leading "0X" or "0x" */
else if (base == 16)
{

View File

@ -1,5 +1,5 @@
/****************************************************************************
* libc/string/lib_strtod.c
* libc/stdlib/lib_strtod.c
* Convert string to double
*
* Copyright (C) 2002 Michael Ringgaard. All rights reserved.

View File

@ -1,5 +1,5 @@
/****************************************************************************
* libc/string/lib_strtol.c
* libc/stdlib/lib_strtol.c
*
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -98,6 +98,7 @@ long strtol(const char *nptr, char **endptr, int base)
return -(long)accum;
}
}
return (long)accum;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* libc/string/lib_strtoll.c
* libc/stdlib/lib_strtoll.c
*
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -100,6 +100,7 @@ long long strtoll(const char *nptr, char **endptr, int base)
return -(long long)accum;
}
}
return (long long)accum;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* /libc/string/lib_strtoul.c
* /libc/stdlib/lib_strtoul.c
*
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -94,6 +94,6 @@ unsigned long strtoul(const char *nptr, char **endptr, int base)
}
}
return accum;
return accum;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* /libc/string/lib_strtoull.c
* /libc/stdlib/lib_strtoull.c
*
* Copyright (C) 2009, 2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>

View File

@ -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)