Permalink
Browse files

flag -v makes dbgprintf superfluous

  • Loading branch information...
1 parent 1d91cdd commit 4309cd8e5c1815d9be84999bb373f075f49cf520 @kr committed Jan 26, 2012
Showing with 1 addition and 21 deletions.
  1. +1 −1 README
  2. +0 −6 dat.h
  3. +0 −14 prot.c
View
2 README
@@ -8,7 +8,7 @@ QUICK START
also,
- $ make CFLAGS='-g -DDEBUG'
+ $ make CFLAGS=-g
$ make CC=clang
$ make check
$ make install
View
6 dat.h
@@ -55,12 +55,6 @@ typedef void(*Record)(void*, int);
#define twarnx(fmt, args...) warnx("%s:%d in %s: " fmt, \
__FILE__, __LINE__, __func__, ##args)
-#ifdef DEBUG
-#define dbgprintf(fmt, args...) ((void) fprintf(stderr, fmt, ##args))
-#else
-#define dbgprintf(fmt, ...) ((void) 0)
-#endif
-
#define URGENT_THRESHOLD 1024
#define JOB_DATA_SIZE_LIMIT_DEFAULT ((1 << 16) - 1)
View
14 prot.c
@@ -279,7 +279,6 @@ reply(conn c, const char *line, int len, int state)
c->reply_len = len;
c->reply_sent = 0;
c->state = state;
- dbgprintf("sending reply: %.*s", len, line);
if (verbose >= 2) {
printf(">%d reply %.*s\n", c->sock.fd, len-2, line);
}
@@ -358,11 +357,8 @@ next_eligible_job(int64 now)
size_t i;
job j = NULL, candidate;
- dbgprintf("tubes.used = %zu\n", tubes.used);
for (i = 0; i < tubes.used; i++) {
t = tubes.items[i];
- dbgprintf("for %s t->waiting.used=%zu t->ready.len=%d t->pause=%" PRIu64 "\n",
- t->name, t->waiting.used, t->ready.len, t->pause);
if (t->pause) {
if (t->deadline_at > now) continue;
t->pause = 0;
@@ -373,7 +369,6 @@ next_eligible_job(int64 now)
j = candidate;
}
}
- dbgprintf("i = %zu, tubes.used = %zu\n", i, tubes.used);
}
return j;
@@ -385,9 +380,7 @@ process_queue()
job j;
int64 now = nanoseconds();
- dbgprintf("processing queue\n");
while ((j = next_eligible_job(now))) {
- dbgprintf("got eligible job %"PRIu64" in %s\n", j->r.id, j->tube->name);
heapremove(&j->tube->ready, j->heap_index);
ready_ct--;
if (j->r.pri < URGENT_THRESHOLD) {
@@ -1170,7 +1163,6 @@ dispatch_cmd(conn c)
}
type = which_cmd(c);
- dbgprintf("got %s command: \"%s\"\n", op_names[(int) type], c->cmd);
if (verbose >= 2) {
printf("<%d command %s\n", c->sock.fd, op_names[type]);
}
@@ -1583,10 +1575,8 @@ conn_timeout(conn c)
}
if (should_timeout) {
- dbgprintf("conn_waiting(%p) = %d\n", c, conn_waiting(c));
return reply_msg(remove_waiting_conn(c), MSG_DEADLINE_SOON);
} else if (conn_waiting(c) && c->pending_timeout >= 0) {
- dbgprintf("conn_waiting(%p) = %d\n", c, conn_waiting(c));
c->pending_timeout = -1;
return reply_msg(remove_waiting_conn(c), MSG_TIMED_OUT);
}
@@ -1757,7 +1747,6 @@ h_conn(const int fd, const short which, conn c)
}
if (which == 'h') {
- dbgprintf("client hung up fd=%d\n", fd);
conn_close(c);
return;
}
@@ -1793,8 +1782,6 @@ prottick(Srv *s)
for (i = 0; i < tubes.used; i++) {
t = tubes.items[i];
- dbgprintf("delay for %s t->waiting.used=%zu t->ready.len=%d t->pause=%" PRIu64 "\n",
- t->name, t->waiting.used, t->ready.len, t->pause);
if (t->pause && t->deadline_at <= now) {
t->pause = 0;
process_queue();
@@ -1870,7 +1857,6 @@ h_accept(const int fd, const short which, Srv *s)
c->sock.f = (Handle)prothandle;
c->sock.fd = cfd;
- dbgprintf("accepted conn, fd=%d\n", cfd);
r = sockwant(&c->sock, 'r');
if (r == -1) {
twarn("sockwant");

0 comments on commit 4309cd8

Please sign in to comment.