Cosmetic change from review of PR53

This commit is contained in:
Gregory Nutt 2016-06-13 08:21:06 -06:00
parent e064439cea
commit 56c5da3030
3 changed files with 18 additions and 27 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -44,10 +44,6 @@
#include "libc.h"
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -72,7 +68,7 @@
int lib_checkbase(int base, FAR const char **pptr)
{
const char *ptr = *pptr;
FAR const char *ptr = *pptr;
/* Check for unspecified base */
@ -113,9 +109,10 @@ int lib_checkbase(int base, FAR const char **pptr)
}
/* Check for incorrect bases. */
else if (base < 2 || base > 26)
{
return -1; /* Means incorrect base */
return -1; /* Means incorrect base */
}
/* Return the updated pointer and base */
@ -123,4 +120,3 @@ int lib_checkbase(int base, FAR const char **pptr)
*pptr = ptr;
return base;
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* /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>
*
* Redistribution and use in source and binary forms, with or without
@ -43,10 +43,6 @@
#include "libc.h"
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -69,7 +65,8 @@
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;
if (nptr)
@ -100,9 +97,9 @@ unsigned long strtoul(FAR const char *nptr, FAR char **endptr, int base)
if (accum < prev)
{
set_errno(ERANGE);
accum = 0;
break;
set_errno(ERANGE);
accum = 0;
break;
}
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* /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>
*
* Redistribution and use in source and binary forms, with or without
@ -46,10 +46,6 @@
#ifdef CONFIG_HAVE_LONG_LONG
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -72,7 +68,8 @@
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;
if (nptr)
@ -103,9 +100,9 @@ unsigned long long strtoull(FAR const char *nptr, FAR char **endptr, int base)
if (accum < prev)
{
set_errno(ERANGE);
accum = 0;
break;
set_errno(ERANGE);
accum = 0;
break;
}
}
@ -116,7 +113,8 @@ unsigned long long strtoull(FAR const char *nptr, FAR char **endptr, int base)
*endptr = (char *)nptr;
}
}
return accum;
return accum;
}
#endif