aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-27 20:58:15 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-27 20:58:15 +0100
commit9e7c3aa5dfbd79b7de55146cd85f5953f7e5f34b (patch)
tree78a4f1eabd15b59c8cfa63c763efc0dacb4973b5
parenttypo (diff)
downloadslibc-9e7c3aa5dfbd79b7de55146cd85f5953f7e5f34b.tar.gz
slibc-9e7c3aa5dfbd79b7de55146cd85f5953f7e5f34b.tar.bz2
slibc-9e7c3aa5dfbd79b7de55146cd85f5953f7e5f34b.tar.xz
fix errors
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
-rw-r--r--include/slibc-human.h7
-rw-r--r--src/slibc-human/machinesize.c11
2 files changed, 10 insertions, 8 deletions
diff --git a/include/slibc-human.h b/include/slibc-human.h
index 34c1cf9..4d4de69 100644
--- a/include/slibc-human.h
+++ b/include/slibc-human.h
@@ -23,6 +23,7 @@
+#define __NEED_size_t
#define __NEED_mode_t
#ifdef __C99__
# define __NEED_intmax_t
@@ -364,7 +365,7 @@ int machinedur(intmax_t* restrict sec, long int* nsec, const char* restrict str,
char* machineint(intmax_t* restrict r, const char* restrict str)
__GCC_ONLY(__attribute__((__warn_unused_result__)));
# ifdef __CONST_CORRECT
-# define machineint(...) (__const_correct_2p(machineint, __VA_ARGS__))
+# define machineint(...) (__const_correct2p(machineint, __VA_ARGS__))
# endif
/* TODO machineuint */
@@ -373,7 +374,7 @@ char* machineint(intmax_t* restrict r, const char* restrict str)
char* machineuint(uintmax_t* restrict r, const char* restrict str)
__GCC_ONLY(__attribute__((__warn_unused_result__)));
# ifdef __CONST_CORRECT
-# define machineuint(...) (__const_correct_2p(machineuint, __VA_ARGS__))
+# define machineuint(...) (__const_correct2p(machineuint, __VA_ARGS__))
# endif
#endif
@@ -383,7 +384,7 @@ char* machineuint(uintmax_t* restrict r, const char* restrict str)
char* machinefloat(long double* restrict r, const char* restrict str,
const char* restrict space, const char* restrict point);
#ifdef __CONST_CORRECT
-# define machinefloat(...) (__const_correct_2(machinefloat, __VA_ARGS__))
+# define machinefloat(...) (__const_correct2(machinefloat, __VA_ARGS__))
#endif
diff --git a/src/slibc-human/machinesize.c b/src/slibc-human/machinesize.c
index 75aa989..9d33a5d 100644
--- a/src/slibc-human/machinesize.c
+++ b/src/slibc-human/machinesize.c
@@ -21,6 +21,7 @@
#include <stddef.h>
#include <stdint.h>
#include <ctype.h>
+#include <string.h>
@@ -37,7 +38,7 @@
__attribute__((nonnull))
static size_t prefix(char** restrict str, enum machinesize_mode mode)
{
-#define P(A, B) case A: case B: n++
+#define P(A, B) case A: case B: power++
char* p = *str;
size_t power = 0;
size_t base = 0;
@@ -113,8 +114,8 @@ int machinesize(size_t* restrict size, const char* restrict str, enum machinesiz
size_t word;
long double dword;
size_t u;
- char* p;
- char* q;
+ const char* p;
+ const char* q;
int started = 0;
int pluses = 0;
int have_unitless = 0;
@@ -143,7 +144,7 @@ int machinesize(size_t* restrict size, const char* restrict str, enum machinesiz
dword *= (long double)u;
if (dword > (long double)SIZE_MAX)
return errno = ERANGE, -1;
- down = (size_t)dword;
+ word = (size_t)dword;
OVERFLOW(uaddl, word, r, &r, ERANGE, -1);
}
else
@@ -151,7 +152,7 @@ int machinesize(size_t* restrict size, const char* restrict str, enum machinesiz
if ((!started) || (have_unitless && (words > 1)))
goto invalid;
- return *save = r, 0;
+ return *size = r, 0;
invalid:
return errno = EINVAL, -1;
}