summaryrefslogtreecommitdiff
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
parente48a37b84457b5892b204f7996e3b7ee2f9a3ad1 (diff)
downloadnuttx-9364f0d5d4690a108567a124c8c52613eb96307a.tar.gz
nuttx-9364f0d5d4690a108567a124c8c52613eb96307a.tar.bz2
nuttx-9364f0d5d4690a108567a124c8c52613eb96307a.zip
Move strol(), stroul(), and friends from libc/string to libc/stdlib where they belong
-rw-r--r--nuttx/ChangeLog2
-rw-r--r--nuttx/libc/stdlib/Make.defs6
-rw-r--r--nuttx/libc/stdlib/lib_checkbase.c (renamed from nuttx/libc/string/lib_checkbase.c)8
-rw-r--r--nuttx/libc/stdlib/lib_strtod.c (renamed from nuttx/libc/string/lib_strtod.c)2
-rw-r--r--nuttx/libc/stdlib/lib_strtol.c (renamed from nuttx/libc/string/lib_strtol.c)3
-rw-r--r--nuttx/libc/stdlib/lib_strtoll.c (renamed from nuttx/libc/string/lib_strtoll.c)3
-rw-r--r--nuttx/libc/stdlib/lib_strtoul.c (renamed from nuttx/libc/string/lib_strtoul.c)4
-rw-r--r--nuttx/libc/stdlib/lib_strtoull.c (renamed from nuttx/libc/string/lib_strtoull.c)2
-rw-r--r--nuttx/libc/string/Make.defs18
9 files changed, 26 insertions, 22 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 976164356..75fb5fee6 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -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).
diff --git a/nuttx/libc/stdlib/Make.defs b/nuttx/libc/stdlib/Make.defs
index 5d726ba3a..5501ef0c1 100644
--- a/nuttx/libc/stdlib/Make.defs
+++ b/nuttx/libc/stdlib/Make.defs
@@ -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
diff --git a/nuttx/libc/string/lib_checkbase.c b/nuttx/libc/stdlib/lib_checkbase.c
index 32ae58dca..4583caf0f 100644
--- a/nuttx/libc/string/lib_checkbase.c
+++ b/nuttx/libc/stdlib/lib_checkbase.c
@@ -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)
{
diff --git a/nuttx/libc/string/lib_strtod.c b/nuttx/libc/stdlib/lib_strtod.c
index 58dfd6a29..5b462b352 100644
--- a/nuttx/libc/string/lib_strtod.c
+++ b/nuttx/libc/stdlib/lib_strtod.c
@@ -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.
diff --git a/nuttx/libc/string/lib_strtol.c b/nuttx/libc/stdlib/lib_strtol.c
index 6ac0d6827..2ed17b8dd 100644
--- a/nuttx/libc/string/lib_strtol.c
+++ b/nuttx/libc/stdlib/lib_strtol.c
@@ -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;
}
diff --git a/nuttx/libc/string/lib_strtoll.c b/nuttx/libc/stdlib/lib_strtoll.c
index 99fba08eb..77ac82000 100644
--- a/nuttx/libc/string/lib_strtoll.c
+++ b/nuttx/libc/stdlib/lib_strtoll.c
@@ -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;
}
diff --git a/nuttx/libc/string/lib_strtoul.c b/nuttx/libc/stdlib/lib_strtoul.c
index 62a768043..38c8209ba 100644
--- a/nuttx/libc/string/lib_strtoul.c
+++ b/nuttx/libc/stdlib/lib_strtoul.c
@@ -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;
}
diff --git a/nuttx/libc/string/lib_strtoull.c b/nuttx/libc/stdlib/lib_strtoull.c
index 4808114af..0a50a90be 100644
--- a/nuttx/libc/string/lib_strtoull.c
+++ b/nuttx/libc/stdlib/lib_strtoull.c
@@ -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>
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)