Cosmetic change from review of PR53
This commit is contained in:
parent
e064439cea
commit
56c5da3030
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/stdlib/lib_checkbase.c
|
* libc/stdlib/lib_checkbase.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -44,10 +44,6 @@
|
|||||||
|
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -72,7 +68,7 @@
|
|||||||
|
|
||||||
int lib_checkbase(int base, FAR const char **pptr)
|
int lib_checkbase(int base, FAR const char **pptr)
|
||||||
{
|
{
|
||||||
const char *ptr = *pptr;
|
FAR const char *ptr = *pptr;
|
||||||
|
|
||||||
/* Check for unspecified base */
|
/* Check for unspecified base */
|
||||||
|
|
||||||
@ -113,9 +109,10 @@ int lib_checkbase(int base, FAR const char **pptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for incorrect bases. */
|
/* Check for incorrect bases. */
|
||||||
|
|
||||||
else if (base < 2 || base > 26)
|
else if (base < 2 || base > 26)
|
||||||
{
|
{
|
||||||
return -1; /* Means incorrect base */
|
return -1; /* Means incorrect base */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the updated pointer and base */
|
/* Return the updated pointer and base */
|
||||||
@ -123,4 +120,3 @@ int lib_checkbase(int base, FAR const char **pptr)
|
|||||||
*pptr = ptr;
|
*pptr = ptr;
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* /libc/stdlib/lib_strtoul.c
|
* /libc/stdlib/lib_strtoul.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -43,10 +43,6 @@
|
|||||||
|
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -69,7 +65,8 @@
|
|||||||
|
|
||||||
unsigned long strtoul(FAR const char *nptr, FAR char **endptr, int base)
|
unsigned long strtoul(FAR const char *nptr, FAR char **endptr, int base)
|
||||||
{
|
{
|
||||||
unsigned long prev, accum = 0;
|
unsigned long accum = 0;
|
||||||
|
unsigned long prev;
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
if (nptr)
|
if (nptr)
|
||||||
@ -100,9 +97,9 @@ unsigned long strtoul(FAR const char *nptr, FAR char **endptr, int base)
|
|||||||
|
|
||||||
if (accum < prev)
|
if (accum < prev)
|
||||||
{
|
{
|
||||||
set_errno(ERANGE);
|
set_errno(ERANGE);
|
||||||
accum = 0;
|
accum = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* /libc/stdlib/lib_strtoull.c
|
* /libc/stdlib/lib_strtoull.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009, 2010 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009, 2010, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -46,10 +46,6 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_HAVE_LONG_LONG
|
#ifdef CONFIG_HAVE_LONG_LONG
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -72,7 +68,8 @@
|
|||||||
|
|
||||||
unsigned long long strtoull(FAR const char *nptr, FAR char **endptr, int base)
|
unsigned long long strtoull(FAR const char *nptr, FAR char **endptr, int base)
|
||||||
{
|
{
|
||||||
unsigned long long prev, accum = 0;
|
unsigned long long accum = 0;
|
||||||
|
unsigned long long prev;
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
if (nptr)
|
if (nptr)
|
||||||
@ -103,9 +100,9 @@ unsigned long long strtoull(FAR const char *nptr, FAR char **endptr, int base)
|
|||||||
|
|
||||||
if (accum < prev)
|
if (accum < prev)
|
||||||
{
|
{
|
||||||
set_errno(ERANGE);
|
set_errno(ERANGE);
|
||||||
accum = 0;
|
accum = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +113,8 @@ unsigned long long strtoull(FAR const char *nptr, FAR char **endptr, int base)
|
|||||||
*endptr = (char *)nptr;
|
*endptr = (char *)nptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return accum;
|
|
||||||
|
return accum;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user