aboutsummaryrefslogtreecommitdiffstats
path: root/src/slibc-human
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 /src/slibc-human
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>
Diffstat (limited to '')
-rw-r--r--src/slibc-human/machinesize.c11
1 files changed, 6 insertions, 5 deletions
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;
}