changeset 359:b9142bae5429

- Switched from DEBUG_MSG to MSG.
author jcid
date Sun, 28 Sep 2008 21:01:17 +0200
parents 37c640e78da0
children 1354085ccbfe
files ChangeLog src/IO/IO.c src/IO/dpi.c src/IO/http.c src/colors.c src/cookies.c src/dns.c src/gif.c src/jpeg.c src/png.c
diffstat 10 files changed, 83 insertions(+), 113 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Sep 28 20:56:55 2008 +0200
+++ b/ChangeLog	Sun Sep 28 21:01:17 2008 +0200
@@ -116,6 +116,7 @@
  - Made image inputs less of a special case by using x,y in ComplexButton.
  - Made forms show their action URL upon enter/leave mouse events (safety).
  - Fixed a memory leak in plain.cc.
+ - Switched from DEBUG_MSG to MSG.
    Patches: place (AKA corvid)
 +- Fixed a problem with locally-installed dpis.
  - Added code for optional image loading (nice interface) very advanced!
--- a/src/IO/IO.c	Sun Sep 28 20:56:55 2008 +0200
+++ b/src/IO/IO.c	Sun Sep 28 21:01:17 2008 +0200
@@ -27,10 +27,6 @@
 #include "IO.h"
 #include "iowatch.hh"
 
-#define DEBUG_LEVEL 5
-//#define DEBUG_LEVEL 1
-#include "../debug.h"
-
 /*
  * Symbolic defines for shutdown() function
  * (Not defined in the same header file, for all distros --Jcid)
@@ -174,7 +170,7 @@
    bool_t ret = FALSE;
    int io_key = io->Key;
 
-   DEBUG_MSG(3, "  IO_read\n");
+   _MSG("  IO_read\n");
 
    /* this is a new read-buffer */
    dStr_truncate(io->Buf, 0);
@@ -226,7 +222,7 @@
    ssize_t St;
    bool_t ret = FALSE;
 
-   DEBUG_MSG(3, "  IO_write\n");
+   _MSG("  IO_write\n");
    io->Status = 0;
 
    while (1) {
--- a/src/IO/dpi.c	Sun Sep 28 20:56:55 2008 +0200
+++ b/src/IO/dpi.c	Sun Sep 28 21:01:17 2008 +0200
@@ -40,10 +40,6 @@
 #include "Url.h"
 #include "../../dpip/dpip.h"
 
-/* #define DEBUG_LEVEL 2 */
-#define DEBUG_LEVEL 4
-#include "../debug.h"
-
 /* This one is tricky, some sources state it should include the byte
  * for the terminating NULL, and others say it shouldn't. */
 # define D_SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
@@ -309,7 +305,7 @@
       if (execl(path1, "dpid", NULL) == -1) {
          dFree(path1);
          if (execlp("dpid", "dpid", NULL) == -1) {
-            DEBUG_MSG(4, "Dpi_start_dpid (child): %s\n", dStrerror(errno));
+            MSG("Dpi_start_dpid (child): %s\n", dStrerror(errno));
             do
                n = write(st_pipe[1], "ERROR", 5);
             while (n == -1 && errno == EINTR);
@@ -319,7 +315,7 @@
       }
    } else if (pid < 0) {
       /* The fork failed.  Report failure.  */
-      DEBUG_MSG(4, "Dpi_start_dpid: %s\n", dStrerror(errno));
+      MSG("Dpi_start_dpid: %s\n", dStrerror(errno));
       /* close the unused pipe */
       Dpi_close_fd(st_pipe[0]);
       Dpi_close_fd(st_pipe[1]);
@@ -330,11 +326,11 @@
       do
          n = read(st_pipe[0], buf, 16);
       while (n == -1 && errno == EINTR);
-      DEBUG_MSG(2, "Dpi_start_dpid: n = %d\n", n);
+      _MSG("Dpi_start_dpid: n = %d\n", n);
       if (n != 5) {
          ret = 0;
       } else {
-         DEBUG_MSG(4, "Dpi_start_dpid: %s\n", dStrerror(errno));
+         MSG("Dpi_start_dpid: %s\n", dStrerror(errno));
       }
    }
 
@@ -358,7 +354,7 @@
 
       if ((SockFD = socket(AF_LOCAL, SOCK_STREAM, 0)) == -1 ||
           connect(SockFD, (void*)&pun, D_SUN_LEN(&pun)) == -1) {
-         DEBUG_MSG(4, "Dpi_check_uds: %s %s\n", dStrerror(errno), uds_name);
+         MSG("Dpi_check_uds: %s %s\n", dStrerror(errno), uds_name);
       } else {
          Dpi_close_fd(SockFD);
          ret = 0;
@@ -448,8 +444,8 @@
    }
 
    dFree(dpid_uds_name);
-   DEBUG_MSG(2, "Dpi_check_dpid:: %s\n",
-             (ret == 0) ? "OK" : (ret == 1 ? "EAGAIN" : "ERROR"));
+   _MSG("Dpi_check_dpid:: %s\n",
+        (ret == 0) ? "OK" : (ret == 1 ? "EAGAIN" : "ERROR"));
    return ret;
 }
 
@@ -485,7 +481,7 @@
    int st;
 
    dReturn_val_if_fail (server_name != NULL, NULL);
-   DEBUG_MSG(2, "Dpi_get_server_uds_name:: server_name = [%s]\n", server_name);
+   _MSG("Dpi_get_server_uds_name:: server_name = [%s]\n", server_name);
 
    dpid_uds_dir = Dpi_get_dpid_uds_dir();
    if (dpid_uds_dir) {
@@ -505,7 +501,7 @@
          perror("connect");
       /* ask dpid to check the server plugin and send its UDS name back */
       request = a_Dpip_build_cmd("cmd=%s msg=%s", "check_server", server_name);
-      DEBUG_MSG(2, "[%s]\n", request);
+      _MSG("[%s]\n", request);
       do
          st = write(sock, request, strlen(request));
       while (st < 0 && errno == EINTR);
@@ -532,7 +528,7 @@
          strncat(rply, buf, (size_t)rdlen);
       }
       Dpi_close_fd(sock);
-      DEBUG_MSG(2, "rply = [%s]\n", rply);
+      _MSG("rply = [%s]\n", rply);
 
       /* Parse reply */
       if (rdlen == 0 && rply) {
@@ -545,7 +541,7 @@
    }
    dFree(dpid_uds_dir);
    dFree(dpid_uds_name);
-   DEBUG_MSG(2, "Dpi_get_server_uds_name:: %s\n", server_uds_name);
+   _MSG("Dpi_get_server_uds_name:: %s\n", server_uds_name);
    return server_uds_name;
 }
 
@@ -563,7 +559,7 @@
 
    /* Query dpid for the UDS name for this server */
    server_uds_name = Dpi_get_server_uds_name(server_name);
-   DEBUG_MSG(2, "server_uds_name = [%s]\n", server_uds_name);
+   _MSG("server_uds_name = [%s]\n", server_uds_name);
 
    if (access(server_uds_name, F_OK) != 0) {
       MSG("server socket was NOT found\n");
@@ -726,11 +722,11 @@
    sa.sun_family = AF_LOCAL;
 
    if ((new_socket = socket(AF_LOCAL, SOCK_STREAM, 0)) == -1) {
-      DEBUG_MSG(4, "a_Dpi_bye_dpid: %s\n", dStrerror(errno));
+      MSG("a_Dpi_bye_dpid: %s\n", dStrerror(errno));
    }
    strncpy(sa.sun_path, srs_name, sizeof (sa.sun_path));
    if (connect(new_socket, (struct sockaddr *) &sa, addr_len) == -1) {
-      DEBUG_MSG(4, "a_Dpi_bye_dpid: %s\n", dStrerror(errno));
+      MSG("a_Dpi_bye_dpid: %s\n", dStrerror(errno));
       MSG("%s\n", sa.sun_path);
    }
    DpiBye_cmd = a_Dpip_build_cmd("cmd=%s", "DpiBye");
--- a/src/IO/http.c	Sun Sep 28 20:56:55 2008 +0200
+++ b/src/IO/http.c	Sun Sep 28 21:01:17 2008 +0200
@@ -47,11 +47,6 @@
 
 #define _MSG_BW(web, root, ...)
 
-#define DEBUG_LEVEL 5
-#include "../debug.h"
-
-
-
 /* 'Url' and 'web' are just references (no need to deallocate them here). */
 typedef struct {
    int SockFD;
@@ -333,7 +328,7 @@
 
    if ((S->SockFD = socket(dh->af, SOCK_STREAM, IPPROTO_TCP)) < 0) {
       S->Err = errno;
-      DEBUG_MSG(5, "Http_connect_socket ERROR: %s\n", dStrerror(errno));
+      MSG("Http_connect_socket ERROR: %s\n", dStrerror(errno));
       return -1;
    }
    /* set NONBLOCKING and close on exec. */
@@ -352,7 +347,7 @@
       sin->sin_port = S->port ? htons(S->port) : htons(DILLO_URL_HTTP_PORT);
       memcpy(&sin->sin_addr, dh->data, (size_t)dh->alen);
       if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl))
-         DEBUG_MSG(5, "Connecting to %s\n", inet_ntoa(sin->sin_addr));
+         MSG("Connecting to %s\n", inet_ntoa(sin->sin_addr));
       break;
    }
 #ifdef ENABLE_IPV6
@@ -366,7 +361,7 @@
       memcpy(&sin6->sin6_addr, dh->data, dh->alen);
       inet_ntop(dh->af, dh->data, buf, sizeof(buf));
       if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl))
-         DEBUG_MSG(5, "Connecting to %s\n", buf);
+         MSG("Connecting to %s\n", buf);
       break;
    }
 #endif
@@ -377,7 +372,7 @@
    if (status == -1 && errno != EINPROGRESS) {
       S->Err = errno;
       Http_socket_close(S);
-      DEBUG_MSG(5, "Http_connect_socket ERROR: %s\n", dStrerror(S->Err));
+      MSG("Http_connect_socket ERROR: %s\n", dStrerror(S->Err));
       return -1;
    } else {
       Http_send_query(S->Info, S);
--- a/src/colors.c	Sun Sep 28 20:56:55 2008 +0200
+++ b/src/colors.c	Sun Sep 28 21:01:17 2008 +0200
@@ -14,8 +14,6 @@
 #include <ctype.h>
 #include "colors.h"
 
-#define DEBUG_LEVEL 5
-#include "debug.h"
 #include "msg.h"
 
 /*
@@ -277,8 +275,8 @@
       }
    }
 
-   DEBUG_MSG(3, "subtag: %s\n", subtag);
-   DEBUG_MSG(3, "color :  %X\n", ret_color);
+   _MSG("subtag: %s\n", subtag);
+   _MSG("color :  %X\n", ret_color);
 
    *err = st;
    return ret_color;
--- a/src/cookies.c	Sun Sep 28 20:56:55 2008 +0200
+++ b/src/cookies.c	Sun Sep 28 21:01:17 2008 +0200
@@ -15,10 +15,6 @@
  * http://www.ietf.org/rfc/rfc2965.txt
  */
 
-#define DEBUG_LEVEL 10
-#include "debug.h"
-
-
 #ifdef DISABLE_COOKIES
 
 /*
@@ -26,7 +22,7 @@
  */
 void a_Cookies_init(void)
 {
-   DEBUG_MSG(10, "Cookies: absolutely disabled at compilation time.\n");
+   MSG("Cookies: absolutely disabled at compilation time.\n");
 }
 
 #else
@@ -94,10 +90,10 @@
             write(fd, init_str, strlen(init_str));
          close(fd);
 
-         DEBUG_MSG(10, "Cookies: Created file: %s\n", filename);
+         MSG("Cookies: Created file: %s\n", filename);
          F_in = fopen(filename, "r");
       } else {
-         DEBUG_MSG(10, "Cookies: Could not create file: %s!\n", filename);
+         MSG("Cookies: Could not create file: %s!\n", filename);
       }
    }
 
@@ -120,11 +116,11 @@
 
    /* Read and parse the cookie control file (cookiesrc) */
    if (Cookie_control_init() != 0) {
-      DEBUG_MSG(10, "Disabling cookies.\n");
+      MSG("Disabling cookies.\n");
       return;
    }
 
-   DEBUG_MSG(10, "Enabling cookies as from cookiesrc...\n");
+   MSG("Enabling cookies as from cookiesrc...\n");
    disabled = FALSE;
 }
 
@@ -150,7 +146,7 @@
 
    action = Cookies_control_check(set_url);
    if (action == COOKIE_DENY) {
-      DEBUG_MSG(5, "Cookies: denied SET for %s\n", URL_HOST_(set_url));
+      _MSG("Cookies: denied SET for %s\n", URL_HOST_(set_url));
       return;
    }
 
@@ -161,7 +157,7 @@
                              "set_cookie", cookie_string, URL_HOST_(set_url),
                              path ? path : "/", numstr);
 
-      DEBUG_MSG(5, "Cookies.c: a_Cookies_set \n\t \"%s\" \n",cmd );
+      _MSG("Cookies.c: a_Cookies_set \n\t \"%s\" \n",cmd );
       /* This call is commented because it doesn't guarantee the order
        * in which cookies are set and got. (It may deadlock too) */
       //a_Capi_dpi_send_cmd(NULL, NULL, cmd, "cookies", 1);
@@ -187,7 +183,7 @@
 
    action = Cookies_control_check(request_url);
    if (action == COOKIE_DENY) {
-      DEBUG_MSG(5, "Cookies: denied GET for %s\n", URL_HOST_(request_url));
+      _MSG("Cookies: denied GET for %s\n", URL_HOST_(request_url));
       return dStrdup("");
    }
    path = URL_PATH_(request_url);
--- a/src/dns.c	Sun Sep 28 20:56:55 2008 +0200
+++ b/src/dns.c	Sun Sep 28 21:01:17 2008 +0200
@@ -31,10 +31,6 @@
 #include "list.h"
 #include "timeout.hh"
 
-#define DEBUG_LEVEL 5
-#include "debug.h"
-
-
 /*
  * Uncomment the following line for debugging or gprof profiling.
  */
@@ -127,8 +123,8 @@
 {
    int i;
 
-   DEBUG_MSG(2, "Dns_queue_remove: deleting client [%d] [queue_size=%d]\n",
-             index, dns_queue_size);
+   _MSG("Dns_queue_remove: deleting client [%d] [queue_size=%d]\n",
+        index, dns_queue_size);
 
    if (index < dns_queue_size) {
       dFree(dns_queue[index].hostname);
@@ -161,7 +157,7 @@
    dns_cache[dns_cache_size].hostname = dStrdup(hostname);
    dns_cache[dns_cache_size].addr_list = addr_list;
    ++dns_cache_size;
-   DEBUG_MSG(1, "Cache objects: %d\n", dns_cache_size);
+   _MSG("Cache objects: %d\n", dns_cache_size);
 }
 
 
@@ -173,9 +169,9 @@
    int i;
 
 #ifdef D_DNS_THREADED
-   DEBUG_MSG(5, "dillo_dns_init: Here we go! (threaded)\n");
+   MSG("dillo_dns_init: Here we go! (threaded)\n");
 #else
-   DEBUG_MSG(5, "dillo_dns_init: Here we go! (not threaded)\n");
+   MSG("dillo_dns_init: Here we go! (not threaded)\n");
 #endif
 
    dns_queue_size = 0;
@@ -278,8 +274,8 @@
 
    Dlist *hosts = dList_new(2);
 
-   DEBUG_MSG(3, "Dns_server: starting...\n ch: %d host: %s\n",
-             channel, dns_server[channel].hostname);
+   _MSG("Dns_server: starting...\n ch: %d host: %s\n",
+        channel, dns_server[channel].hostname);
 
    error = getaddrinfo(dns_server[channel].hostname, NULL, &hints, &res0);
 
@@ -310,8 +306,8 @@
    }
 
    /* tell our findings */
-   DEBUG_MSG(5, "Dns_server [%d]: %s is %p\n", channel,
-             dns_server[channel].hostname, hosts);
+   MSG("Dns_server [%d]: %s is %p\n", channel,
+       dns_server[channel].hostname, hosts);
    dns_server[channel].addr_list = hosts;
    dns_server[channel].ip_ready = TRUE;
 
--- a/src/gif.c	Sun Sep 28 20:56:55 2008 +0200
+++ b/src/gif.c	Sun Sep 28 21:01:17 2008 +0200
@@ -72,9 +72,6 @@
 #include "dicache.h"
 #include "prefs.h"
 
-#define DEBUG_LEVEL 6
-#include "debug.h"
-
 #define INTERLACE      0x40
 #define LOCALCOLORMAP  0x80
 
@@ -245,7 +242,7 @@
    buf = ((uchar_t *) Buf) + gif->Start_Ofs;
    bufsize = BufSize - gif->Start_Ofs;
 
-   DEBUG_MSG(5, "Gif_write: %u bytes\n", BufSize);
+   _MSG("Gif_write: %u bytes\n", BufSize);
 
    /* Process the bytes in the input buffer. */
    bytes_consumed = Gif_process_bytes(gif, buf, bufsize, Buf);
@@ -254,7 +251,7 @@
       return;
    gif->Start_Ofs += bytes_consumed;
 
-   DEBUG_MSG(5, "exit Gif_write, bufsize=%ld\n", (long)bufsize);
+   _MSG("exit Gif_write, bufsize=%ld\n", (long)bufsize);
 }
 
 /*
@@ -264,7 +261,7 @@
 {
    int i;
 
-   DEBUG_MSG(5, "destroy gif %p\n", gif);
+   _MSG("destroy gif %p\n", gif);
 
    a_Dicache_close(gif->url, gif->version, Client);
 
@@ -545,7 +542,7 @@
       for (; o_size > 0 && o_index > 0; o_size--) {
          uint_t code_and_byte = gif->code_and_byte[code];
 
-         DEBUG_MSG(5, "%d ", gif->code_and_byte[code] & 255);
+         _MSG("%d ", gif->code_and_byte[code] & 255);
 
          obuf[--o_index] = code_and_byte & 255;
          code = code_and_byte >> 8;
@@ -565,16 +562,16 @@
    }
    /* Ok, now we write the first byte of the sequence. */
    /* We are sure that the code is literal. */
-   DEBUG_MSG(5, "%d", code);
+   _MSG("%d", code);
    obuf[--o_index] = code;
    gif->code_and_byte[gif->last_code] |= code;
 
    /* Fix up the output if the original code was last_code. */
    if (orig_code == gif->last_code) {
       *last_byte_ptr = code;
-      DEBUG_MSG(5, " fixed (%d)!", code);
+      _MSG(" fixed (%d)!", code);
    }
-   DEBUG_MSG(5, "\n");
+   _MSG("\n");
 
    /* Output any full lines. */
    if (gif->line_index >= gif->Width) {
@@ -621,7 +618,7 @@
     */
    if (code < clear_code) {
       /* a literal code. */
-      DEBUG_MSG(5, "literal\n");
+      _MSG("literal\n");
       Gif_literal(gif, code);
       return 1;
    } else if (code >= clear_code + 2) {
@@ -632,11 +629,11 @@
       return 1;
    } else if (code == clear_code) {
       /* clear code. Resets the whole table */
-      DEBUG_MSG(5, "clear\n");
+      _MSG("clear\n");
       return 0;
    } else {
       /* end code. */
-      DEBUG_MSG(5, "end\n");
+      _MSG("end\n");
       return 2;
    }
 }
@@ -694,7 +691,7 @@
              * at the start of the window */
             code = (window >> (32 - bits_in_window)) & code_mask;
 
-            DEBUG_MSG(5, "code = %d, ", code);
+            _MSG("code = %d, ", code);
 
             bits_in_window -= code_size;
             switch (Gif_process_code(gif, code, clear_code)) {
@@ -1042,8 +1039,8 @@
       break;
    }
 
-   DEBUG_MSG(5, "Gif_process_bytes: final state %d, %ld bytes consumed\n",
-             gif->state, (long)(bufsize - tmp_bufsize));
+   _MSG("Gif_process_bytes: final state %d, %ld bytes consumed\n",
+        gif->state, (long)(bufsize - tmp_bufsize));
 
    return bufsize - tmp_bufsize;
 }
--- a/src/jpeg.c	Sun Sep 28 20:56:55 2008 +0200
+++ b/src/jpeg.c	Sun Sep 28 21:01:17 2008 +0200
@@ -36,9 +36,7 @@
 #include "cache.h"
 #include "dicache.h"
 #include "capi.h"       /* get cache entry status */
-
-#define DEBUG_LEVEL 6
-#include "debug.h"
+#include "msg.h"
 
 typedef enum {
    DILLO_JPEG_INIT,
@@ -154,11 +152,11 @@
 {
    DilloJpeg *jpeg = ((my_source_mgr *) cinfo->src)->jpeg;
 
-   DEBUG_MSG(5, "fill_input_buffer\n");
+   _MSG("fill_input_buffer\n");
 #if 0
    if (!cinfo->src->bytes_in_buffer) {
-      DEBUG_MSG(5, "fill_input_buffer: %ld bytes in buffer\n",
-                (long)cinfo->src->bytes_in_buffer);
+      _MSG("fill_input_buffer: %ld bytes in buffer\n",
+           (long)cinfo->src->bytes_in_buffer);
 
       jpeg->Start_Ofs = (ulong_t) jpeg->cinfo.src->next_input_byte -
          (ulong_t) jpeg->Data;
@@ -185,10 +183,9 @@
       return;
    jpeg = ((my_source_mgr *) cinfo->src)->jpeg;
 
-   DEBUG_MSG(5, "skip_input_data: Start_Ofs = %lu, num_bytes = %ld,"
-             " %ld bytes in buffer\n",
-             (ulong_t)jpeg->Start_Ofs, num_bytes,
-             (long)cinfo->src->bytes_in_buffer);
+   _MSG("skip_input_data: Start_Ofs = %lu, num_bytes = %ld,"
+        " %ld bytes in buffer\n",
+        (ulong_t)jpeg->Start_Ofs, num_bytes,(long)cinfo->src->bytes_in_buffer);
 
    cinfo->src->next_input_byte += num_bytes;
    if (num_bytes < (long)cinfo->src->bytes_in_buffer) {
@@ -257,8 +254,8 @@
    JSAMPLE *array[1];
    int num_read;
 
-   DEBUG_MSG(5, "Jpeg_write: (%p) Bytes in buff: %ld Ofs: %lu\n", jpeg,
-             (long) BufSize, (ulong_t)jpeg->Start_Ofs);
+   _MSG("Jpeg_write: (%p) Bytes in buff: %ld Ofs: %lu\n", jpeg,
+        (long) BufSize, (ulong_t)jpeg->Start_Ofs);
 
    /* See if we are supposed to skip ahead. */
    if (BufSize <= jpeg->Start_Ofs)
@@ -286,8 +283,8 @@
          else if (jpeg->cinfo.num_components == 3)
             type = DILLO_IMG_TYPE_RGB;
          else
-            DEBUG_MSG(5, "jpeg: can't handle %d component images\n",
-                      jpeg->cinfo.num_components);
+            _MSG("jpeg: can't handle %d component images\n",
+                 jpeg->cinfo.num_components);
 
          /*
           * If a multiple-scan image is not completely in cache,
--- a/src/png.c	Sun Sep 28 20:56:55 2008 +0200
+++ b/src/png.c	Sun Sep 28 21:01:17 2008 +0200
@@ -31,17 +31,16 @@
 #include "dicache.h"
 #include "prefs.h"
 
-#define DEBUG_LEVEL 6
-#include "debug.h"
-
 enum prog_state {
    IS_finished, IS_init, IS_nextdata
 };
 
+#if 0
 static char *prog_state_name[] =
 {
    "IS_finished", "IS_init", "IS_nextdata"
 };
+#endif
 
 /*
  * This holds the data that must be saved between calls to this module.
@@ -120,7 +119,7 @@
 {
    DilloPng *png;
 
-   DEBUG_MSG(6, "Png_error_handling: %s\n", msg);
+   MSG("Png_error_handling: %s\n", msg);
    png = png_get_error_ptr(png_ptr);
 
    png->error = 1;
@@ -139,7 +138,7 @@
    uint_t i;
    double gamma;
 
-   DEBUG_MSG(5, "Png_datainfo_callback:\n");
+   _MSG("Png_datainfo_callback:\n");
 
    png = png_get_progressive_ptr(png_ptr);
    dReturn_if_fail (png != NULL);
@@ -147,9 +146,9 @@
    png_get_IHDR(png_ptr, info_ptr, &png->width, &png->height,
                 &bit_depth, &color_type, &interlace_type, NULL, NULL);
 
-   DEBUG_MSG(5, "Png_datainfo_callback: png->width  = %ld\n"
-             "Png_datainfo_callback: png->height = %ld\n",
-             png->width, png->height);
+   _MSG("Png_datainfo_callback: png->width  = %ld\n"
+        "Png_datainfo_callback: png->height = %ld\n",
+        png->width, png->height);
 
    /* we need RGB/RGBA in the end */
    if (color_type == PNG_COLOR_TYPE_PALETTE && bit_depth <= 8) {
@@ -196,10 +195,10 @@
    png->channels = png_get_channels(png_ptr, info_ptr);
 
    /* init Dillo specifics */
-   DEBUG_MSG(5, "Png_datainfo_callback: rowbytes = %d\n"
-             "Png_datainfo_callback: width    = %ld\n"
-             "Png_datainfo_callback: height   = %ld\n",
-             png->rowbytes, png->width, png->height);
+   _MSG("Png_datainfo_callback: rowbytes = %d\n"
+        "Png_datainfo_callback: width    = %ld\n"
+        "Png_datainfo_callback: height   = %ld\n",
+        png->rowbytes, png->width, png->height);
 
    png->image_data = (uchar_t *) dMalloc(png->rowbytes * png->height);
    png->row_pointers = (uchar_t **) dMalloc(png->height * sizeof(uchar_t *));
@@ -225,7 +224,7 @@
    if (!new_row)                /* work to do? */
       return;
 
-   DEBUG_MSG(5, "Png_datarow_callback: row_num = %ld\n", row_num);
+   _MSG("Png_datarow_callback: row_num = %ld\n", row_num);
 
    png = png_get_progressive_ptr(png_ptr);
 
@@ -292,7 +291,7 @@
 {
    DilloPng *png;
 
-   DEBUG_MSG(5, "Png_dataend_callback:\n");
+   _MSG("Png_dataend_callback:\n");
 
    png = png_get_progressive_ptr(png_ptr);
    png->state = IS_finished;
@@ -343,7 +342,7 @@
    /* Let's make some sound if we have been called with no data */
    dReturn_if_fail ( Client->Buf != NULL && Client->BufSize > 0 );
 
-   DEBUG_MSG(5, "Png_callback BufSize = %d\n", Client->BufSize);
+   _MSG("Png_callback BufSize = %d\n", Client->BufSize);
 
    /* Keep local copies so we don't have to pass multiple args to
     * a number of functions. */
@@ -352,7 +351,7 @@
 
    /* start/resume the FSM here */
    while (png->state != IS_finished && DATASIZE) {
-      DEBUG_MSG(5, "State = %s\n", prog_state_name[png->state]);
+      _MSG("State = %s\n", prog_state_name[png->state]);
 
       switch (png->state) {
       case IS_init:
@@ -448,11 +447,10 @@
    DilloWeb *web = Ptr;
    DICacheEntry *DicEntry;
 
-   DEBUG_MSG(5, "a_Png_image: Type = %s\n"
-             "a_Png_image: libpng - Compiled %s; using %s.\n"
-             "a_Png_image: zlib   - Compiled %s; using %s.\n",
-             Type, PNG_LIBPNG_VER_STRING, png_libpng_ver,
-             ZLIB_VERSION, zlib_version);
+   _MSG("a_Png_image: Type = %s\n"
+        "a_Png_image: libpng - Compiled %s; using %s.\n"
+        "a_Png_image: zlib   - Compiled %s; using %s.\n",
+        Type, PNG_LIBPNG_VER_STRING, png_libpng_ver,ZLIB_VERSION,zlib_version);
 
    if (!web->Image)
       web->Image = a_Image_new(0, 0, NULL, prefs.bg_color);