about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--example.c6
-rw-r--r--stecpe.c2
-rw-r--r--tests.c2
4 files changed, 7 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 0be968b..7773c49 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+CFLAGS=-g -O2 -Wall -Wno-switch -Wextra -Wwrite-strings
+
 all: libste.a example
 
 libste.a: stechr.o stecpe.o stecpy.o steprn.o
diff --git a/example.c b/example.c
index e9f57d5..0429663 100644
--- a/example.c
+++ b/example.c
@@ -11,13 +11,13 @@
 int
 main(int argc, char *argv[])
 {
-	char *path = getenv("PATH");
+	const char *path = getenv("PATH");
 	if (!path)
 	    path = "";
 
-	char *program = argc > 1 ? argv[1] : "xyzzy";
+	const char *program = argc > 1 ? argv[1] : "xyzzy";
 
-	char *pathend = path + strlen(path);
+	const char *pathend = path + strlen(path);
 
 	char buf[PATH_MAX];
 	char *bufend = buf + sizeof buf;
diff --git a/stecpe.c b/stecpe.c
index 0cfbaad..b943843 100644
--- a/stecpe.c
+++ b/stecpe.c
@@ -7,7 +7,7 @@ stecpe(char *dst, const char *end, const char *src, const char *srcend)
         if (dst >= end)
                 return dst;
 
-	size_t l = end - dst - 1;
+	ptrdiff_t l = end - dst - 1;
 	size_t t = 1;
 	if (srcend - src < l) {
 		l = srcend - src;
diff --git a/tests.c b/tests.c
index 306a693..fa2e0ff 100644
--- a/tests.c
+++ b/tests.c
@@ -6,7 +6,7 @@
 static int status;
 
 void
-is(char *desc, int ok)
+is(const char *desc, int ok)
 {
 	if (!ok)
 		status = 1;