Clean up some -pedantic warnings about passing non-void-pointers with %p.
authorMichael Poole <mdpoole@troilus.org>
Sun, 23 Mar 2008 15:24:05 +0000 (11:24 -0400)
committerMichael Poole <mdpoole@troilus.org>
Sun, 23 Mar 2008 15:24:05 +0000 (11:24 -0400)
src/dict-splay.c (dict_sanity_check_node): Cast struct pointers to void*
    when passing them to snprintf().
src/helpfile.c (vsend_message): Likewise for log_module().
src/mod-sockcheck.c (sockcheck_free_client): Likewise.
  (sockcheck_print_client): Likewise.
  (sockcheck_elaborate_state): Likewise.
  (sockcheck_advance): Likewise.
  (sockcheck_begin_test): Likewise.
  (sockcheck_start_client): Likewise.
src/proto-p10.c (AddUser): Likewise.
src/sar.c (sar_fd_readable): Likewise.
  (sar_getaddr_append): Likewise.

src/dict-splay.c
src/helpfile.c
src/mod-sockcheck.c
src/proto-p10.c
src/sar.c

index fd72965897a492db53f0eedea40c4297ac890d00..2c8a282a77413c38fd9940a3cdaa487cef90f9a2 100644 (file)
@@ -305,20 +305,20 @@ dict_sanity_check_node(struct dict_node *node, struct dict_sanity_struct *dss)
 {
     verify(node);
     if (!node->key) {
-        snprintf(dss->error, sizeof(dss->error), "Node %p had null key", node);
+        snprintf(dss->error, sizeof(dss->error), "Node %p had null key", (void*)node);
         return 1;
     }
     if (node->l) {
         if (dict_sanity_check_node(node->l, dss)) return 1;
         if (irccasecmp(node->l->key, node->key) >= 0) {
-            snprintf(dss->error, sizeof(dss->error), "Node %p's left child's key '%s' >= its key '%s'", node, node->l->key, node->key);
+            snprintf(dss->error, sizeof(dss->error), "Node %p's left child's key '%s' >= its key '%s'", (void*)node, node->l->key, node->key);
             return 1;
         }
     }
     if (node->r) {
         if (dict_sanity_check_node(node->r, dss)) return 1;
         if (irccasecmp(node->key, node->r->key) >= 0) {
-            snprintf(dss->error, sizeof(dss->error), "Node %p's right child's key '%s' <= its key '%s'", node, node->r->key, node->key);
+            snprintf(dss->error, sizeof(dss->error), "Node %p's right child's key '%s' <= its key '%s'", (void*)node, node->r->key, node->key);
             return 1;
         }
     }
index d090a4c9f9f2bfdf096c0eae39bf0dec606191b2..a21b0c8ce9c911013fdf2254b4b475d20c92fc53 100644 (file)
@@ -589,7 +589,7 @@ vsend_message(const char *dest, struct userNode *src, struct handle_info *handle
                 break;
             default:
                 value = "";
-                log_module(MAIN_LOG, LOG_ERROR, "Invalid exp.type %d from expansion function %p.", exp.type, expand_f);
+                log_module(MAIN_LOG, LOG_ERROR, "Invalid exp.type %d from expansion function %p.", exp.type, (void*)expand_f);
                 break;
             }
             ipos = name_end - input.list;
index 9a188316ab47574aa870f4a369825d5525c0d965..cd78ba8da137ee55a9d3909ba6c2d9c3aa5f8775 100644 (file)
@@ -227,7 +227,7 @@ static void
 sockcheck_free_client(struct sockcheck_client *client)
 {
     if (SOCKCHECK_DEBUG) {
-        log_module(PC_LOG, LOG_INFO, "Goodbye %s (%p)!  I set you free!", client->addr->hostname, client);
+        log_module(PC_LOG, LOG_INFO, "Goodbye %s (%p)!  I set you free!", client->addr->hostname, (void*)client);
     }
     verify(client);
     ioset_close(client->fd, 1);
@@ -260,15 +260,15 @@ sockcheck_print_client(const struct sockcheck_client *client)
     log_module(PC_LOG, LOG_INFO, "client %p: { addr = %p { decision = %s; last_touched = %lu; reason = %s; hostname = \"%s\" }; "
         "test_index = %d; state = %p { port = %d; type = %s; template = \"%s\"; ... }; "
         "fd = %p(%d); read = %p; read_size = %d; read_used = %d; read_pos = %d; }",
-        client, client->addr, decs[client->addr->decision],
+        (void*)client, (void*)client->addr, decs[client->addr->decision],
         client->addr->last_touched,
         client->addr->reason, client->addr->hostname,
-        client->test_index, client->state,
+        client->test_index, (void*)client->state,
         (client->state ? client->state->port : 0),
         (client->state ? decs[client->state->type] : "N/A"),
         (client->state ? client->state->template : "N/A"),
-        client->fd, (client->fd ? client->fd->fd : 0),
-        client->read, client->read_size, client->read_used, client->read_pos);
+        (void*)client->fd, (client->fd ? client->fd->fd : 0),
+        (void*)client->read, client->read_size, client->read_used, client->read_pos);
 }
 
 static char hexvals[256] = {
@@ -407,7 +407,7 @@ sockcheck_elaborate_state(struct sockcheck_client *client)
         /* If it doesn't require reading, take it now. */
         if (client->resp_state[nn] && !*client->resp_state[nn]) {
             if (SOCKCHECK_DEBUG) {
-                log_module(PC_LOG, LOG_INFO, "Skipping straight to easy option %d for %p.", nn, client);
+                log_module(PC_LOG, LOG_INFO, "Skipping straight to easy option %d for %p.", nn, (void*)client);
             }
             sockcheck_advance(client, nn);
             return;
@@ -510,7 +510,7 @@ sockcheck_advance(struct sockcheck_client *client, unsigned int next_state)
         }
         break;
     default:
-        log_module(PC_LOG, LOG_ERROR, "BUG: unknown next-state type %d (after %p).", ns->type, client->state);
+        log_module(PC_LOG, LOG_ERROR, "BUG: unknown next-state type %d (after %p).", ns->type, (void*)client->state);
         break;
     }
 }
@@ -672,7 +672,7 @@ sockcheck_begin_test(struct sockcheck_client *client)
         io_fd->readable_cb = sockcheck_readable;
         timeq_add(now + client->state->timeout, sockcheck_timeout_client, client);
         if (SOCKCHECK_DEBUG) {
-            log_module(PC_LOG, LOG_INFO, "Starting proxy check on %s:%d (test %d) with fd %d (%p).", client->addr->hostname, client->state->port, client->test_index, io_fd->fd, io_fd);
+            log_module(PC_LOG, LOG_INFO, "Starting proxy check on %s:%d (test %d) with fd %d (%p).", client->addr->hostname, client->state->port, client->test_index, io_fd->fd, (void*)io_fd);
         }
         return;
     } while (client->test_index < client->tests->used);
@@ -696,7 +696,7 @@ sockcheck_start_client(unsigned int idx)
     sockcheck_num_clients++;
     if (!tests) return;
     client = client_list[idx] = sockcheck_alloc_client(sci);
-    log_module(PC_LOG, LOG_INFO, "Proxy-checking client at %s as client %d (%p) of %d.", sci->hostname, idx, client, sockcheck_num_clients);
+    log_module(PC_LOG, LOG_INFO, "Proxy-checking client at %s as client %d (%p) of %d.", sci->hostname, idx, (void*)client, sockcheck_num_clients);
     client->test_rep = 0;
     client->client_index = idx;
     sockcheck_begin_test(client);
index 94f41debe61c7da89c8937b9413ac4992f099a52..e4077ac224965397327b487e71697da65dbc657f 100644 (file)
@@ -2064,17 +2064,17 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char *
     unsigned int n, ignore_user, dummy;
 
     if ((strlen(numeric) < 3) || (strlen(numeric) > 5)) {
-        log_module(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): numeric %s wrong length!", uplink, nick, numeric);
+        log_module(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): numeric %s wrong length!", (void*)uplink, nick, numeric);
         return NULL;
     }
 
     if (!uplink) {
-        log_module(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): server for numeric %s doesn't exist!", uplink, nick, numeric);
+        log_module(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): server for numeric %s doesn't exist!", (void*)uplink, nick, numeric);
         return NULL;
     }
 
     if (uplink != GetServerN(numeric)) {
-        log_module(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): server for numeric %s differs from nominal uplink %s.", uplink, nick, numeric, uplink->name);
+        log_module(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): server for numeric %s differs from nominal uplink %s.", (void*)uplink, nick, numeric, uplink->name);
         return NULL;
     }
 
@@ -2082,7 +2082,7 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char *
     if (dummy) {
         ++modes;
     } else if (!is_valid_nick(nick)) {
-        log_module(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): invalid nickname detected.", uplink, nick);
+        log_module(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): invalid nickname detected.", (void*)uplink, nick);
         return NULL;
     }
 
index 6c5c73194b053bbb9e4f6677ecb1f9aef8af4b5a..43cc638fafe5a15e7a7e042518a1d0791c5a7530 100644 (file)
--- a/src/sar.c
+++ b/src/sar.c
@@ -632,7 +632,7 @@ sar_fd_readable(struct io_fd *fd)
 
     sprintf(id_text, "%d", hdr.id);
     req = dict_find(sar_requests, id_text, NULL);
-    log_module(sar_log, LOG_DEBUG, "sar_fd_readable(%p): hdr {id=%d, flags=0x%x, qdcount=%d, ancount=%d, nscount=%d, arcount=%d} -> req %p", fd, hdr.id, hdr.flags, hdr.qdcount, hdr.ancount, hdr.nscount, hdr.arcount, req);
+    log_module(sar_log, LOG_DEBUG, "sar_fd_readable(%p): hdr {id=%d, flags=0x%x, qdcount=%d, ancount=%d, nscount=%d, arcount=%d} -> req %p", (void*)fd, hdr.id, hdr.flags, hdr.qdcount, hdr.ancount, hdr.nscount, hdr.arcount, (void*)req);
     if (!req || !req->retries || !(hdr.flags & REQ_FLAG_QR)) {
         ns->resp_ignored++;
         return;
@@ -1137,7 +1137,7 @@ sar_getaddr_append(struct sar_getaddr_state *state, struct addrinfo *ai, int cop
 {
     unsigned int count;
 
-    log_module(sar_log, LOG_DEBUG, "sar_getaddr_append({full_name=%s}, ai=%p, copy=%d)", state->full_name, ai, copy);
+    log_module(sar_log, LOG_DEBUG, "sar_getaddr_append({full_name=%s}, ai=%p, copy=%d)", state->full_name, (void*)ai, copy);
 
     /* Set the appropriate pointer to the new element(s). */
     if (state->ai_tail)