diff --git a/src/pollcat.c b/src/pollcat.c index cb4fdf0..40a87e3 100644 --- a/src/pollcat.c +++ b/src/pollcat.c @@ -133,7 +133,7 @@ static struct pollfd *pollcat_search (int fd) /* Do binary search and cache result */ key.fd = fd; - ret = bsearch(&key, pollcat_list, sizeof(struct pollfd), pollcat_used, pollcat_comp); + ret = bsearch(&key, pollcat_list, pollcat_used, sizeof(struct pollfd), pollcat_comp); pollcat_last = ret ? ret - pollcat_list : -1; return ret; } @@ -336,15 +336,19 @@ static const char *pollcat_bits (short int events) return buff; } +#endif void pollcat_dump (FILE *fp) { +#if POLLCAT_DEBUG int i; if ( !fp && stderr ) fp = stderr; if ( !fp && stdout ) fp = stdout; + if ( !fp ) + return; fprintf(fp, "pollcat: list %p, used %zu / size %zu\n", pollcat_list, pollcat_used, pollcat_size); @@ -365,6 +369,6 @@ void pollcat_dump (FILE *fp) fprintf(fp, "%-8s %s\n", pollcat_bits(pollcat_list[i].revents), link); } -} #endif +}