summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adrien Schildknecht <adrien+dev@schischi.me>2013-04-26 01:11:46 +0200
committerGravatar Adrien Schildknecht <adrien+dev@schischi.me>2013-04-26 01:11:46 +0200
commitdd1a5bfd320be1b7250ed2521b4361af72df6fc3 (patch)
tree36ddd832f4d6b83a6f54ed53ffff3c64393d584e
parent612dd81b51a443a19e6a2c17f67ef46ea4c2c123 (diff)
remove remaining warnings
-rw-r--r--Makefile4
-rw-r--r--xcwd.c9
2 files changed, 9 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index d7e549f..15b6b80 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,13 @@
CFILES=xcwd.c
CC=gcc
-CFLAGS=-Wall -Werror -std=gnu99
+CFLAGS=-Wall -Werror -Wextra -pedantic -std=gnu99 -O2
LDFLAGS=-lX11
EXE="xcwd"
O=${CFILES:.c=.o}
prefix=/usr/
${EXE}: clean ${O}
- ${CC} -o $@ ${O} ${CFLAGS} ${LDFLAGS}
+ ${CC} -o $@ ${O} ${CFLAGS} ${LDFLAGS}
.SUFFIXES: .c .o
.c.o:
diff --git a/xcwd.c b/xcwd.c
index 955c9d2..2a89b0e 100644
--- a/xcwd.c
+++ b/xcwd.c
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <strings.h>
#include <unistd.h>
#include <glob.h>
#include <sys/stat.h>
@@ -102,7 +103,7 @@ static char* windowStrings(Window focuswin, size_t *size, char* hint)
Atom nameAtom = XInternAtom(dpy, hint, 1);
Atom type;
int format;
- int i;
+ unsigned int i;
unsigned long after;
unsigned char *data = 0;
char *ret = NULL;
@@ -195,6 +196,9 @@ static void readPath(long pid)
int main(int argc, const char *argv[])
{
+ (void)argc;
+ (void)argv;
+
processes_t p;
long pid;
Window w = focusedWindow();
@@ -211,8 +215,9 @@ int main(int argc, const char *argv[])
else {
size_t size;
char* strings;
- int i;
+ unsigned int i;
struct proc_s *res = NULL, key;
+
qsort(p->ps, p->n, sizeof(struct proc_s), nameCmp);
strings = windowStrings(w, &size, "WM_CLASS");
for(i = 0; i < size; i += strlen(strings + i) + 1) {