lib/stdlib: Change some macro to inline function
to avoid the build break for "using ::xxx" Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: Ib5d861a6c2b9e6ba585df83b3cdff8a3e1495bce
This commit is contained in:
parent
806710b225
commit
eac66d76b3
@ -158,7 +158,15 @@ int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg);
|
|||||||
/* _Exit() is a stdlib.h equivalent to the unistd.h _exit() function */
|
/* _Exit() is a stdlib.h equivalent to the unistd.h _exit() function */
|
||||||
|
|
||||||
void _exit(int status); /* See unistd.h */
|
void _exit(int status); /* See unistd.h */
|
||||||
#define _Exit(s) _exit(s)
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
inline void _Exit(int s)
|
||||||
|
{
|
||||||
|
_exit(s);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define _Exit(s) _exit(s)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* System() command is not implemented in the NuttX libc because it is so
|
/* System() command is not implemented in the NuttX libc because it is so
|
||||||
* entangled with shell logic. There is an experimental version at
|
* entangled with shell logic. There is an experimental version at
|
||||||
@ -187,13 +195,44 @@ double strtod(FAR const char *str, FAR char **endptr);
|
|||||||
long double strtold(FAR const char *str, FAR char **endptr);
|
long double strtold(FAR const char *str, FAR char **endptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define atoi(nptr) ((int)strtol((nptr), NULL, 10))
|
#ifdef __cplusplus
|
||||||
#define atol(nptr) strtol((nptr), NULL, 10)
|
inline int atoi(FAR const char *nptr)
|
||||||
|
{
|
||||||
|
return (int)strtol(nptr, NULL, 10);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define atoi(nptr) ((int)strtol((nptr), NULL, 10))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
inline int atol(FAR const char *nptr)
|
||||||
|
{
|
||||||
|
return strtol(nptr, NULL, 10);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define atol(nptr) strtol((nptr), NULL, 10)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_HAVE_LONG_LONG
|
#ifdef CONFIG_HAVE_LONG_LONG
|
||||||
|
#ifdef __cplusplus
|
||||||
|
inline long long atoll(FAR const char *nptr)
|
||||||
|
{
|
||||||
|
return strtoll(nptr, NULL, 10);
|
||||||
|
}
|
||||||
|
#else
|
||||||
#define atoll(nptr) strtoll((nptr), NULL, 10)
|
#define atoll(nptr) strtoll((nptr), NULL, 10)
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_HAVE_DOUBLE
|
#ifdef CONFIG_HAVE_DOUBLE
|
||||||
#define atof(nptr) strtod((nptr), NULL)
|
#ifdef __cplusplus
|
||||||
|
inline double atof(FAR const char *nptr)
|
||||||
|
{
|
||||||
|
return strtod(nptr, NULL);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define atof(nptr) strtod((nptr), NULL)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Binary to string conversions */
|
/* Binary to string conversions */
|
||||||
|
Loading…
Reference in New Issue
Block a user