commit f6664293f08fb52b553f58f5ff1e6aa1e45c0da0
parent ac0907679d89781fbf420526f3fe0caec8bcff43
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Wed, 17 Feb 2021 22:23:47 -0600
remove unused variables, build with c99 -Wall
Diffstat:
5 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,2 +1,2 @@
all:
- gcc -Werror kiss.c pkg.c util.c
+ c99 -Wall -Werror http.c kiss.c pkg.c util.c -ltls
diff --git a/http.c b/http.c
@@ -1,3 +1,5 @@
+#define _BSD_SOURCE
+
#include <ctype.h>
#include <errno.h>
#include <libgen.h>
@@ -118,7 +120,6 @@ edial(const char *host, const char *port)
struct addrinfo hints, *res, *res0;
int error, save_errno, s;
const char *cause = NULL;
- struct timeval timeout;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
@@ -374,10 +375,7 @@ err:
int
http_fetch(char *loc, char *path)
{
- char *end;
int statuscode;
- long long l;
- FILE *file;
url = loc;
if (parseuri(url, &u) == -1)
@@ -389,8 +387,9 @@ http_fetch(char *loc, char *path)
mkdirs(dirname(path));
- if ((dest = fopen(path, "w")) == NULL)
+ if ((dest = fopen(path, "w")) == NULL) {
die("%s: failed to open %s:", __func__, path);
+ }
if (!strcmp(u.proto, "https")) {
if (tls_init())
diff --git a/pkg.c b/pkg.c
@@ -72,7 +72,6 @@ int
pkg_exists(const char *repo, const char *name, char *path)
{
DIR *pkg;
- int found = 0;
if (strlen(repo) + strlen(name) > PATH_LEN)
die("%s: repo path length + package name > max path length", __func__);
diff --git a/util.c b/util.c
@@ -60,7 +60,7 @@ vstrcmp(const void *p1, const void *p2)
}
/* replace occurences of a with b in str, starting from end */
-int
+void
strrepl(char *str, const char a, const char b)
{
for (char *p = str + strlen(str); p >= str; p--) {
diff --git a/util.h b/util.h
@@ -14,7 +14,7 @@ extern char *argv0;
void warn(const char *, ...);
void die(const char *, ...);
int vstrcmp(const void *p1, const void *p2);
-int strrepl(char *str, const char a, const char b);
+void strrepl(char *str, const char a, const char b);
int mkdirs(const char *path);
#endif /* UTIL_H */