about summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2019-02-19 05:33:04 +0100
committerQuentin Rameau <quinq@fifth.space>2020-11-01 16:59:11 +0100
commit8d5e2b3a40a86d463d666cbf61906cf22febde34 (patch)
treec2edf2220d3c05f5979281fced8a9726bd4f4a28
parentMakefile: rework how webextensions are handled (diff)
downloadsurf-8d5e2b3a40a86d463d666cbf61906cf22febde34.tar.gz
surf-8d5e2b3a40a86d463d666cbf61906cf22febde34.tar.bz2
surf-8d5e2b3a40a86d463d666cbf61906cf22febde34.zip
Remove common
-rw-r--r--Makefile14
-rw-r--r--common.c15
-rw-r--r--common.h2
-rw-r--r--surf.c12
-rw-r--r--webext-surf.c6
5 files changed, 21 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index c3a87c5..9f93b0b 100644
--- a/Makefile
+++ b/Makefile
@@ -5,10 +5,8 @@
 include config.mk
 
 SRC = surf.c
-CSRC = common.c
 WSRC = webext-surf.c
 OBJ = $(SRC:.c=.o)
-COBJ = $(CSRC:.c=.o)
 WOBJ = $(WSRC:.c=.o)
 WLIB = $(WSRC:.c=.so)
 
@@ -25,23 +23,21 @@ options:
 	$(CC) $(SURFCFLAGS) $(CFLAGS) -c $<
 
 .o.so:
-	$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ \
-	    $< $(COBJ) $(WEBEXTLIBS)
+	$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $< $(WEBEXTLIBS)
 
 config.h:
 	cp config.def.h $@
 
-$(OBJ) $(COBJ) $(WOBJ): config.h common.h config.mk
-$(WLIB): $(COBJ)
+$(OBJ) $(WOBJ): config.h common.h config.mk
 
-surf: $(OBJ) $(COBJ)
-	$(CC) $(SURFLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(COBJ) $(LIBS)
+surf: $(OBJ)
+	$(CC) $(SURFLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
 
 $(WOBJ):
 	$(CC) $(WEBEXTCFLAGS) $(CFLAGS) -c $(@:.o=.c)
 
 clean:
-	rm -f surf $(OBJ) $(COBJ)
+	rm -f surf $(OBJ)
 	rm -f $(WLIB) $(WOBJ)
 
 distclean: clean
diff --git a/common.c b/common.c
deleted file mode 100644
index 42662ed..0000000
--- a/common.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-void
-die(const char *errstr, ...)
-{
-	va_list ap;
-
-	va_start(ap, errstr);
-	vfprintf(stderr, errstr, ap);
-	va_end(ap);
-	exit(1);
-}
-
diff --git a/common.h b/common.h
index 2778029..3990c42 100644
--- a/common.h
+++ b/common.h
@@ -1,3 +1 @@
 #define MSGBUFSZ 8
-
-void die(char *, ...);
diff --git a/surf.c b/surf.c
index 2b54e3c..42927e9 100644
--- a/surf.c
+++ b/surf.c
@@ -141,6 +141,7 @@ typedef struct {
 } SiteSpecific;
 
 /* Surf */
+static void die(const char *errstr, ...);
 static void usage(void);
 static void setup(void);
 static void sigchld(int unused);
@@ -302,6 +303,17 @@ static ParamName loadfinished[] = {
 #include "config.h"
 
 void
+die(const char *errstr, ...)
+{
+       va_list ap;
+
+       va_start(ap, errstr);
+       vfprintf(stderr, errstr, ap);
+       va_end(ap);
+       exit(1);
+}
+
+void
 usage(void)
 {
 	die("usage: surf [-bBdDfFgGiIkKmMnNpPsStTvwxX]\n"
diff --git a/webext-surf.c b/webext-surf.c
index ec9a235..ec471d1 100644
--- a/webext-surf.c
+++ b/webext-surf.c
@@ -26,8 +26,10 @@ newpage(WebKitWebPage *page)
 {
 	Page *p;
 
-	if (!(p = calloc(1, sizeof(Page))))
-		die("Cannot malloc!\n");
+	if (!(p = calloc(1, sizeof(Page)))) {
+		fputs("Cannot malloc!\n", stderr);
+		exit(1);
+	}
 
 	p->next = pages;
 	pages = p;