From dcf3f79e9ba82ded5a2eca4bdbd653d936be8d5b Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Wed, 13 Nov 2013 21:34:32 +0100 Subject: [PATCH] move string conversion functions to stdlib.h --- include/eduos/stddef.h | 28 ++++------------------------ include/eduos/stdlib.h | 28 +++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/include/eduos/stddef.h b/include/eduos/stddef.h index 888e372..483f4ad 100644 --- a/include/eduos/stddef.h +++ b/include/eduos/stddef.h @@ -37,33 +37,13 @@ extern "C" { #define NULL ((void*) 0) +/* + * macros, which are later used to determine the core id + * and their "private" data + */ #define per_core(name) name #define CORE_ID 0 -/** @brief String to long - * - * @return Long value of the parsed numerical string - */ -long strtol(const char* str, char** endptr, int base); - -/** @brief String to unsigned long - * - * @return Unsigned long value of the parsed numerical string - */ -unsigned long strtoul(const char* nptr, char** endptr, int base); - -/** @brief ASCII to integer - * - * Convenience function using strtol(). - * - * @return Integer value of the parsed numerical string - */ -static inline int atoi(const char *str) -{ - return (int)strtol(str, (char **)NULL, 10); -} - - #ifdef __cplusplus } #endif diff --git a/include/eduos/stdlib.h b/include/eduos/stdlib.h index fcc7bd4..3267837 100644 --- a/include/eduos/stdlib.h +++ b/include/eduos/stdlib.h @@ -38,13 +38,39 @@ #define __STDLIB_H__ #include -#include #include #ifdef __cplusplus extern "C" { #endif +/** @brief String to long + * + * Convert a string value to a long + * + * @return Long value of the parsed numerical string + */ +long strtol(const char* str, char** endptr, int base); + +/** @brief String to unsigned long + * + * Convert a string value to a unsigned long + * + * @return Unsigned long value of the parsed numerical string + */ +unsigned long strtoul(const char* nptr, char** endptr, int base); + +/** @brief ASCII to integer + * + * Convert ASCII string to integer + * + * @return Integer value of the parsed numerical string + */ +static inline int atoi(const char *str) +{ + return (int)strtol(str, (char **)NULL, 10); +} + #ifdef __cplusplus } #endif