Avoid the use of the %p format.
+2005-05-14 Hrvoje Niksic <hniksic@xemacs.org>
+
+ * openssl.c (ssl_connect): Announce the beginning and the end of
+ the SSL handshake when in debug mode.
+
+ * wget.h (PTR_FORMAT): New macro for easier printing of pointer
+ values. Use %0*lx along with PTR_FORMAT instead of %p.
+
2005-05-14 Hrvoje Niksic <hniksic@xemacs.org>
* http.c (gethttp): Would forget to close the connection when
address_list_release (struct address_list *al)
{
--al->refcount;
- DEBUGP (("Releasing %p (new refcount %d).\n", al, al->refcount));
+ DEBUGP (("Releasing 0x%0*lx (new refcount %d).\n", PTR_FORMAT (al),
+ al->refcount));
if (al->refcount <= 0)
{
- DEBUGP (("Deleting unused %p.\n", al));
+ DEBUGP (("Deleting unused 0x%0*lx.\n", PTR_FORMAT (al)));
address_list_delete (al);
}
}
{
SSL *ssl;
+ DEBUGP (("Initiating SSL handshake.\n"));
+
assert (ssl_ctx != NULL);
ssl = SSL_new (ssl_ctx);
if (!ssl)
functions are used for reading, writing, and polling. */
fd_register_transport (fd, openssl_read, openssl_write, openssl_poll,
openssl_peek, openssl_close, ssl);
- DEBUGP (("Connected %d to SSL 0x%0*lx\n", fd, 2 * sizeof (void *),
- (unsigned long) ssl));
+ DEBUGP (("Handshake successful; connected socket %d to SSL handle 0x%0*lx\n",
+ fd, PTR_FORMAT (ssl)));
return 1;
error:
+ DEBUGP (("SSL handshake failed.\n"));
print_errors ();
if (ssl)
SSL_free (ssl);
/* The certificate was found, verified, and matched HOST. */
success = 1;
+ DEBUGP (("X509 certificate successfully verified and matches host %s\n",
+ escnonprint (host)));
out:
if (cert)
basevar = (type *)xrealloc (basevar, DR_newsize * sizeof (type)); \
} while (0)
+/* Used to print pointers (usually for debugging). Print pointers
+ using printf ("%0*lx", PTR_FORMAT (p)). (%p is too unpredictable;
+ some implementations prepend 0x, while some don't, and most don't
+ 0-pad the address.) */
+#define PTR_FORMAT(p) 2 * sizeof (void *), (unsigned long) (p)
+
extern const char *exec_name;
\f
/* Document type ("dt") flags */
malloc_count, free_count, malloc_count - free_count);
for (i = 0; i < SZ; i++)
if (malloc_table[i].ptr != NULL)
- printf ("0x%0*lx: %s:%d\n", 2 * sizeof (void *),
- (long) malloc_table[i].ptr,
+ printf ("0x%0*lx: %s:%d\n", PTR_FORMAT (malloc_table[i].ptr),
malloc_table[i].file, malloc_table[i].line);
}
if (!unregister_ptr (ptr))
{
fprintf (stderr, "%s: bad xfree(%0*lx) at %s:%d\n",
- exec_name, 2 * sizeof (void *), (long) ptr,
- source_file, source_line);
+ exec_name, PTR_FORMAT (ptr), source_file, source_line);
abort ();
}
++free_count;