summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib/num.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/libreboot-utils/lib/num.c')
-rw-r--r--util/libreboot-utils/lib/num.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/util/libreboot-utils/lib/num.c b/util/libreboot-utils/lib/num.c
index e13a8853..ce5e420d 100644
--- a/util/libreboot-utils/lib/num.c
+++ b/util/libreboot-utils/lib/num.c
@@ -28,10 +28,7 @@
unsigned short
hextonum(char ch_s)
{
- int saved_errno = errno;
-
unsigned char ch;
- size_t rval;
ch = (unsigned char)ch_s;
@@ -43,8 +40,8 @@ hextonum(char ch_s)
if ((unsigned int)(ch - 'a') <= 5)
return ch - 'a' + 10;
- if (ch == '?' || ch == 'x')
- return rsize(16); /* <-- with rejection sampling! */
+ if (ch == '?' || ch == 'x') /* random */
+ return (short)rsize(16); /* <-- with rejection sampling! */
return 16;
}
@@ -83,7 +80,7 @@ spew_hex(const void *data, size_t len)
if (len <= 4294967296) /* below 4GB */
printf("%08zx ", i);
else
- printf("%0*zx ", sizeof(size_t) * 2, i);
+ printf("%16zu ", i);
for (j = 0; j < 16; j++) {
@@ -114,6 +111,6 @@ void
check_bin(size_t a, const char *a_name)
{
if (a > 1)
- err_exit(EINVAL, "%s must be 0 or 1, but is %lu",
+ exitf("%s must be 0 or 1, but is %lu",
a_name, (size_t)a);
}