aboutsummaryrefslogtreecommitdiffstats
path: root/loc.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-09-16 18:25:31 +0200
committerMattias Andrée <maandree@kth.se>2021-09-16 18:25:31 +0200
commit3ef4603788b3e4cef56bc113903548e71ade06a9 (patch)
tree7ffe7547c29dec58de4f8e08638858190c6b815d /loc.c
parentUpdate config.mk (diff)
downloadloc-3ef4603788b3e4cef56bc113903548e71ade06a9.tar.gz
loc-3ef4603788b3e4cef56bc113903548e71ade06a9.tar.bz2
loc-3ef4603788b3e4cef56bc113903548e71ade06a9.tar.xz
Improve makefile and fix warnings4.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'loc.c')
-rw-r--r--loc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/loc.c b/loc.c
index 855ad5b..1f309c8 100644
--- a/loc.c
+++ b/loc.c
@@ -11,6 +11,7 @@
#include "arg.h"
+
char *argv0;
struct result {
@@ -168,7 +169,7 @@ main(int argc, char *argv[])
else
ret = 1;
} else {
- if (!(res = calloc(argc, sizeof(struct result))))
+ if (!(res = calloc((size_t)argc, sizeof(struct result))))
fprintf(stderr, "%s: out of memory\n", argv0), exit(1);
for (i = 0; i < argc; i++) {
if (!strcmp(argv[i], "-")) {
@@ -182,7 +183,7 @@ main(int argc, char *argv[])
if (res[i].n >= 0) {
left = strwidth(argv[i]);
maxleft = left > maxleft ? left : maxleft;
- right = zuwidth(res[i].n);
+ right = zuwidth((size_t)res[i].n);
maxright = right > maxright ? right : maxright;
res[i].width = left + right;
}