[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH 2/6] libc: atoi-Deklaration gefixt



! libc: atoi gehoert nach stdlib.h
! libc: atoi gibt einen signed-Wert zurueck

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 src/include/stdlib.h |    3 +++
 src/include/string.h |    2 --
 src/lib/string.c     |    5 ++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/include/stdlib.h b/src/include/stdlib.h
index 745d32d..62cd49b 100644
--- a/src/include/stdlib.h
+++ b/src/include/stdlib.h
@@ -54,6 +54,9 @@ long strtol(const char* str, char** endptr, int base);
 unsigned long strtoul(const char *nptr, char **endptr, int base);
 unsigned long long strtoull(const char *nptr, char **endptr, int base);
 
+int atoi(const char* s);
+long atol(const char* str);
+
 char* getenv(const char* name);
 int setenv(const char* name, const char* value, int overwrite);
 
diff --git a/src/include/string.h b/src/include/string.h
index 0e082fe..e530689 100644
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -68,8 +68,6 @@ size_t strspn(const char* s, const char* charset);
 size_t strcspn(const char* s, const char* charset);
 
 void itoa(unsigned int n, char* s, unsigned int base);
-unsigned int atoi(const char* s);
-long atol(const char* str);
 
 char* index(const char* p, int ch);
 
diff --git a/src/lib/string.c b/src/lib/string.c
index 2cb1e80..f6f4132 100644
--- a/src/lib/string.c
+++ b/src/lib/string.c
@@ -154,10 +154,9 @@ unsigned long int strtoul(const char *nptr, char **endptr, int base)
 }
 
 
-unsigned int atoi(const char *s)
+int atoi(const char *s)
 {
-    // FIXME Eigentlich ist atoi ja signed...
-    return (unsigned int) strtoull(s, NULL, 10);
+    return (int) strtoull(s, NULL, 10);
 }
 //
 
-- 
1.6.0.2