]> mj.ucw.cz Git - libucw.git/commitdiff
The great conversion of log() logging function to msg().
authorPavel Charvat <pavel.charvat@netcentrum.cz>
Thu, 21 Jun 2007 12:18:53 +0000 (14:18 +0200)
committerPavel Charvat <pavel.charvat@netcentrum.cz>
Thu, 21 Jun 2007 12:18:53 +0000 (14:18 +0200)
Sherlock.h still defines log() alias to UCW's msg().
Lib/math.h has been moved to sherlock/math.h.

24 files changed:
images/color.c
images/context.c
images/hilbert-test.c
images/image-sim-test.c
images/image-tool.c
images/sig-cmp.c
images/sig-init.c
lib/Makefile
lib/bitsig.c
lib/conf-input.c
lib/conf-intr.c
lib/conf-section.c
lib/fb-file.c
lib/fb-mmap.c
lib/lib.h
lib/lizard-safe.c
lib/log.c
lib/mainloop.c
lib/math.h [deleted file]
lib/qache.c
lib/runcmd.c
lib/shell/logger.c
lib/sorter.h
lib/sync.c

index ee1525e098847e45de81bb9bcebbb36368f80fb5..8003c7bed75d8d5106d5d470b5b416db022c6a56 100644 (file)
@@ -10,7 +10,7 @@
 #undef LOCAL_DEBUG
 
 #include "sherlock/sherlock.h"
-#include "lib/math.h"
+#include "sherlock/math.h"
 #include "images/images.h"
 #include "images/color.h"
 #include "images/error.h"
index 6281ba3cb0974874b0974383b45de2a2b1972820..baebb9b8d53d34c20d14a69f97dd524a877f0f83 100644 (file)
@@ -35,7 +35,7 @@ image_context_cleanup(struct image_context *ctx)
 void
 image_context_msg_default(struct image_context *ctx)
 {
-  log(ctx->msg_code >> 24, "%s", ctx->msg);
+  msg(ctx->msg_code >> 24, "%s", ctx->msg);
 }
 
 void
index 9824f092600da500a8c7328773ed683c620f1311..ce2466c221cd413f4d82a1cab29a6fbaf3e33be5 100644 (file)
@@ -4,9 +4,9 @@
 
 #include "lib/lib.h"
 #include "lib/mempool.h"
-#include "lib/math.h"
 #include <stdlib.h>
 #include <stdio.h>
+#include <math.h>
 
 static struct mempool *pool;
 
index 1a54909138b767bf0d002486227c19837b8dda33..d48758873816f3445303e2ba7fc6cd32f193a1ad 100644 (file)
@@ -68,7 +68,7 @@ static byte *segmentation_name_2;
 static uns display_base64;
 static uns display_base224;
 
-#define MSG(x...) do{ if (verbose) log(L_INFO, ##x); }while(0)
+#define MSG(x...) do{ if (verbose) msg(L_INFO, ##x); }while(0)
 #define TRY(x) do{ if (!(x)) exit(1); }while(0)
 
 static void
index e1717569f86ef165331c2856442fc452ac07be13..b211f1969852a999ef52777a8c22a9db8ef2b1a9 100644 (file)
@@ -84,7 +84,7 @@ parse_color(struct color *color, byte *s)
   color_make_rgb(color, (v >> 16) & 255, (v >> 8) & 255, v & 255);
 }
 
-#define MSG(x...) do{ if (verbose) log(L_INFO, ##x); }while(0)
+#define MSG(x...) do{ if (verbose) msg(L_INFO, ##x); }while(0)
 
 int
 main(int argc, char **argv)
index b420f0673ce95d39fb9132be2a7508947d81eaab..c663c2b3edc56afd1c0db7afb9606b3b7538d3dc 100644 (file)
@@ -10,7 +10,6 @@
 #undef LOCAL_DEBUG
 
 #include "lib/lib.h"
-#include "lib/math.h"
 #include "images/math.h"
 #include "images/images.h"
 #include "images/signature.h"
index 57eaa71b6b64f480b2d928408eac3ab91b45b90d..4c45556c8acd93fa9866a325690947233082457f 100644 (file)
@@ -10,9 +10,9 @@
 #undef LOCAL_DEBUG
 
 #include "sherlock/sherlock.h"
+#include "sherlock/math.h"
 #include "lib/fastbuf.h"
 #include "lib/conf.h"
-#include "lib/math.h"
 #include "images/images.h"
 #include "images/math.h"
 #include "images/error.h"
index 8cc43c1434b9f7ca9cd05245b8db0c3a5101a635..08fe41b2a0db90bae2c18ad2d73485e1bd22cd41 100644 (file)
@@ -34,7 +34,7 @@ LIBUCW_MODS= \
        getopt
 
 LIBUCW_INCLUDES= \
-       lib.h config.h threads.h math.h \
+       lib.h config.h threads.h \
        mempool.h pagecache.h \
        sorter.h sorter-globals.h arraysort.h \
        lists.h clists.h slists.h simple-lists.h \
index 9b072e1fc3dcc5c038bfd00645779b5cd4fd101e..8ffe8dbc9340d5f441afb0b92ffbc2df07855e17 100644 (file)
@@ -72,7 +72,7 @@ bitsig_init(uns perrlog, uns maxn)
   b->maxn = maxn;
   b->max_m_mult = (0xffffffff / m) * m;
   bzero(b->array, mbytes);
-  log(L_DEBUG, "Initialized bitsig array with l=%d, m=%u (%u KB), expecting %d items", b->l, b->m, (mbytes+1023)/1024, maxn);
+  msg(L_DEBUG, "Initialized bitsig array with l=%d, m=%u (%u KB), expecting %d items", b->l, b->m, (mbytes+1023)/1024, maxn);
   return b;
 }
 
@@ -139,7 +139,7 @@ bitsig_insert(struct bitsig *b, byte *item)
        }
     }
   if (!was && b->n++ == b->maxn+1)
-    log(L_ERROR, "bitsig: Too many items inserted, error rate will be higher than estimated!");
+    msg(L_ERROR, "bitsig: Too many items inserted, error rate will be higher than estimated!");
   return was;
 }
 
index d7e7766e971e390e408422f7848abb768e78abe8..260d9f2a50cdf80d7a9d797d682a5dda78b27063 100644 (file)
@@ -141,31 +141,31 @@ get_word(uns is_command_name)
 }
 
 static byte *
-get_token(uns is_command_name, byte **msg)
+get_token(uns is_command_name, byte **err)
 {
-  *msg = NULL;
+  *err = NULL;
   while (1) {
     if (!*line || *line == '#') {
-      if (!is_command_name || !get_line(msg))
+      if (!is_command_name || !get_line(err))
        return NULL;
     } else if (*line == ';') {
-      *msg = get_word(0);
-      if (!is_command_name || *msg)
+      *err = get_word(0);
+      if (!is_command_name || *err)
        return NULL;
     } else if (*line == '\\' && !line[1]) {
-      if (!get_line(msg)) {
-       if (!*msg)
-         *msg = "Last line ends by a backslash";
+      if (!get_line(err)) {
+       if (!*err)
+         *err = "Last line ends by a backslash";
        return NULL;
       }
       if (!*line || *line == '#')
-       log(L_WARN, "The line %s:%d following a backslash is empty", name_parse_fb ? : (byte*) "", line_num);
+       msg(L_WARN, "The line %s:%d following a backslash is empty", name_parse_fb ? : (byte*) "", line_num);
     } else {
       split_grow(&word_buf, words+1);
       uns start = copied;
       word_buf.ptr[words++] = copied;
-      *msg = get_word(is_command_name);
-      return *msg ? NULL : copy_buf.ptr + start;
+      *err = get_word(is_command_name);
+      return *err ? NULL : copy_buf.ptr + start;
     }
   }
 }
@@ -197,7 +197,7 @@ split_command(void)
 static byte *
 parse_fastbuf(const byte *name_fb, struct fastbuf *fb, uns depth)
 {
-  byte *msg;
+  byte *err;
   name_parse_fb = name_fb;
   parse_fb = fb;
   line_num = 0;
@@ -205,8 +205,8 @@ parse_fastbuf(const byte *name_fb, struct fastbuf *fb, uns depth)
   *line = 0;
   while (1)
   {
-    msg = split_command();
-    if (msg)
+    err = split_command();
+    if (err)
       goto error;
     if (!words)
       return NULL;
@@ -217,23 +217,23 @@ parse_fastbuf(const byte *name_fb, struct fastbuf *fb, uns depth)
     if (!strcasecmp(name, "include"))
     {
       if (words != 2)
-       msg = "Expecting one filename";
+       err = "Expecting one filename";
       else if (depth > 8)
-       msg = "Too many nested files";
+       err = "Too many nested files";
       else if (*line && *line != '#')          // because the contents of line_buf is not re-entrant and will be cleared
-       msg = "The input command must be the last one on a line";
-      if (msg)
+       err = "The input command must be the last one on a line";
+      if (err)
        goto error;
       struct fastbuf *new_fb = bopen_try(pars[0], O_RDONLY, 1<<14);
       if (!new_fb) {
-       msg = cf_printf("Cannot open file %s: %m", pars[0]);
+       err = cf_printf("Cannot open file %s: %m", pars[0]);
        goto error;
       }
       uns ll = line_num;
-      msg = parse_fastbuf(stk_strdup(pars[0]), new_fb, depth+1);
+      err = parse_fastbuf(stk_strdup(pars[0]), new_fb, depth+1);
       line_num = ll;
       bclose(new_fb);
-      if (msg)
+      if (err)
        goto error;
       parse_fb = fb;
       continue;
@@ -259,23 +259,23 @@ parse_fastbuf(const byte *name_fb, struct fastbuf *fb, uns depth)
        default: op = OP_SET; break;
       }
       if (strcasecmp(c, cf_op_names[op])) {
-       msg = cf_printf("Unknown operation %s", c);
+       err = cf_printf("Unknown operation %s", c);
        goto error;
       }
     }
     if (ends_by_brace)
       op |= OP_OPEN;
-    msg = cf_interpret_line(name, op, words-1, pars);
-    if (msg)
+    err = cf_interpret_line(name, op, words-1, pars);
+    if (err)
       goto error;
   }
 error:
   if (name_fb)
-    log(L_ERROR, "File %s, line %d: %s", name_fb, line_num, msg);
+    msg(L_ERROR, "File %s, line %d: %s", name_fb, line_num, err);
   else if (line_num == 1)
-    log(L_ERROR, "Manual setting of configuration: %s", msg);
+    msg(L_ERROR, "Manual setting of configuration: %s", err);
   else
-    log(L_ERROR, "Manual setting of configuration, line %d: %s", line_num, msg);
+    msg(L_ERROR, "Manual setting of configuration, line %d: %s", line_num, err);
   return "included from here";
 }
 
@@ -305,12 +305,12 @@ load_file(const byte *file)
   cf_init_stack();
   struct fastbuf *fb = bopen_try(file, O_RDONLY, 1<<14);
   if (!fb) {
-    log(L_ERROR, "Cannot open %s: %m", file);
+    msg(L_ERROR, "Cannot open %s: %m", file);
     return 1;
   }
-  byte *msg = parse_fastbuf(file, fb, 0);
+  byte *err_msg = parse_fastbuf(file, fb, 0);
   bclose(fb);
-  int err = !!msg || done_stack();
+  int err = !!err_msg || done_stack();
   if (!err)
     cf_def_file = NULL;
   return err;
index 8bc06f82323fc6280842900c04c356f066f98e78..827a935cdf8cb45c1fe13951a935f5bea7d8d0c1 100644 (file)
@@ -637,7 +637,7 @@ int
 cf_check_stack(void)
 {
   if (level > 0) {
-    log(L_ERROR, "Unterminated block");
+    msg(L_ERROR, "Unterminated block");
     return 1;
   }
   return 0;
index e4a0712f0bbb627e0d91cf61b93ddb5b22abffd7..2851d26dd0bebf763c52a8dec471dc21473d6adc 100644 (file)
@@ -164,14 +164,14 @@ commit_section(struct cf_section *sec, void *ptr, uns commit_all)
   for (struct cf_item *ci=sec->cfg; ci->cls; ci++)
     if (ci->cls == CC_SECTION) {
       if ((err = commit_section(ci->u.sec, ptr + (uintptr_t) ci->ptr, commit_all))) {
-       log(L_ERROR, "Cannot commit section %s: %s", ci->name, err);
+       msg(L_ERROR, "Cannot commit section %s: %s", ci->name, err);
        return "commit of a subsection failed";
       }
     } else if (ci->cls == CC_LIST) {
       uns idx = 0;
       CLIST_FOR_EACH(cnode *, n, * (clist*) (ptr + (uintptr_t) ci->ptr))
        if (idx++, err = commit_section(ci->u.sec, n, commit_all)) {
-         log(L_ERROR, "Cannot commit node #%d of list %s: %s", idx, ci->name, err);
+         msg(L_ERROR, "Cannot commit node #%d of list %s: %s", idx, ci->name, err);
          return "commit of a list failed";
        }
     }
index 637446a02b065925d56484ce59c82e6785c36886..dd8d14886a6872e4fa74bd0a8add456467d93492 100644 (file)
@@ -71,7 +71,7 @@ bfd_close(struct fastbuf *f)
     {
     case 1:
       if (unlink(f->name) < 0)
-       log(L_ERROR, "unlink(%s): %m", f->name);
+       msg(L_ERROR, "unlink(%s): %m", f->name);
     case 0:
       close(FB_FILE(f)->fd);
     }
@@ -160,7 +160,7 @@ bfilesync(struct fastbuf *b)
 {
   bflush(b);
   if (fsync(FB_FILE(b)->fd) < 0)
-    log(L_ERROR, "fsync(%s) failed: %m", b->name);
+    msg(L_ERROR, "fsync(%s) failed: %m", b->name);
 }
 
 #ifdef TEST
index 948dcf5850bc44267f9d9f7fc76474de4890baae..28e90df47ca10b9afdfe70cce0f87f6b610deed0 100644 (file)
@@ -145,7 +145,7 @@ bfmm_close(struct fastbuf *f)
     {
     case 1:
       if (unlink(f->name) < 0)
-       log(L_ERROR, "unlink(%s): %m", f->name);
+       msg(L_ERROR, "unlink(%s): %m", f->name);
     case 0:
       close(F->fd);
     }
index 2230a8cd726bae624c123ff55da8a22be9183c38..4eeab68228b64d37efff0f9cd5f7991874db6dc1 100644 (file)
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -99,9 +99,8 @@ extern void (*log_die_hook)(void);
 struct tm;
 extern void (*log_switch_hook)(struct tm *tm);
 
-void log_msg(uns cat, const char *msg, ...) FORMAT_CHECK(printf,2,3);
-#define log log_msg
-void vlog_msg(uns cat, const char *msg, va_list args);
+void msg(uns cat, const char *fmt, ...) FORMAT_CHECK(printf,2,3);
+void vmsg(uns cat, const char *fmt, va_list args);
 void die(const char *, ...) NONRET FORMAT_CHECK(printf,1,2);
 void log_init(const char *argv0);
 void log_file(const char *name);
@@ -120,7 +119,7 @@ void assert_failed_noinfo(void) NONRET;
 #define COMPILE_ASSERT(name,x) typedef char _COMPILE_ASSERT_##name[!!(x)-1]
 
 #ifdef LOCAL_DEBUG
-#define DBG(x,y...) log(L_DEBUG, x,##y)
+#define DBG(x,y...) msg(L_DEBUG, x,##y)
 #else
 #define DBG(x,y...) do { } while(0)
 #endif
index 3b927831a71767c1b802a75e0c61ceab82f41b29..e8e8f6fa822c8900fb6349f8a9040209ffd7e93e 100644 (file)
@@ -93,7 +93,7 @@ lizard_decompress_safe(const byte *in, struct lizard_buffer *buf, uns expected_l
   }
   else
   {
-    log(L_ERROR, "SIGSEGV caught in lizard_decompress()");
+    msg(L_ERROR, "SIGSEGV caught in lizard_decompress()");
     ptr = NULL;
     errno = EFAULT;
   }
index 8f56f06f6cb0f2e98345271455b9512088740bb8..0063f3ea7eed13d2239f28f85cda35d8a475d927 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -26,7 +26,7 @@ void (*log_die_hook)(void);
 void (*log_switch_hook)(struct tm *tm);
 
 void
-vlog_msg(unsigned int cat, const char *msg, va_list args)
+vmsg(unsigned int cat, const char *fmt, va_list args)
 {
   struct timeval tv;
   struct tm tm;
@@ -66,7 +66,7 @@ vlog_msg(unsigned int cat, const char *msg, va_list args)
       l0 = p - buf + 1;
       r = buflen - l0;
       va_copy(args2, args);
-      l = vsnprintf(p, r, msg, args2);
+      l = vsnprintf(p, r, fmt, args2);
       va_end(args2);
       if (l < 0)
        l = r;
@@ -87,22 +87,22 @@ vlog_msg(unsigned int cat, const char *msg, va_list args)
 }
 
 void
-log_msg(unsigned int cat, const char *msg, ...)
+msg(unsigned int cat, const char *fmt, ...)
 {
   va_list args;
 
-  va_start(args, msg);
-  vlog_msg(cat, msg, args);
+  va_start(args, fmt);
+  vmsg(cat, fmt, args);
   va_end(args);
 }
 
 void
-die(const char *msg, ...)
+die(const char *fmt, ...)
 {
   va_list args;
 
-  va_start(args, msg);
-  vlog_msg(L_FATAL, msg, args);
+  va_start(args, fmt);
+  vmsg(L_FATAL, fmt, args);
   va_end(args);
   if (log_die_hook)
     log_die_hook();
@@ -116,7 +116,7 @@ die(const char *msg, ...)
 void
 assert_failed(const char *assertion, const char *file, int line)
 {
-  log(L_FATAL, "Assertion `%s' failed at %s:%d", assertion, file, line);
+  msg(L_FATAL, "Assertion `%s' failed at %s:%d", assertion, file, line);
   abort();
 }
 
index 5344dcadc5609c7bce92ce2c635b1fdbac4febae..aeb79de479b0aa0cf0eb6f930c997116f2c13c15 100644 (file)
@@ -101,7 +101,7 @@ file_add(struct main_file *fi)
   main_file_cnt++;
   main_poll_table_obsolete = 1;
   if (fcntl(fi->fd, F_SETFL, O_NONBLOCK) < 0)
-    log(L_ERROR, "Error setting fd %d to non-blocking mode: %m. Keep fingers crossed.", fi->fd);
+    msg(L_ERROR, "Error setting fd %d to non-blocking mode: %m. Keep fingers crossed.", fi->fd);
 }
 
 void
@@ -307,25 +307,25 @@ void
 main_debug(void)
 {
 #ifdef CONFIG_DEBUG
-  log(L_DEBUG, "### Main loop status on %lld", (long long)main_now);
-  log(L_DEBUG, "\tActive timers:");
+  msg(L_DEBUG, "### Main loop status on %lld", (long long)main_now);
+  msg(L_DEBUG, "\tActive timers:");
   struct main_timer *tm;
   CLIST_WALK(tm, main_timer_list)
-    log(L_DEBUG, "\t\t%p (expires %lld, data %p)", tm, (long long)(tm->expires ? tm->expires-main_now : 999999), tm->data);
+    msg(L_DEBUG, "\t\t%p (expires %lld, data %p)", tm, (long long)(tm->expires ? tm->expires-main_now : 999999), tm->data);
   struct main_file *fi;
-  log(L_DEBUG, "\tActive files:");
+  msg(L_DEBUG, "\tActive files:");
   CLIST_WALK(fi, main_file_list)
-    log(L_DEBUG, "\t\t%p (fd %d, rh %p, wh %p, eh %p, expires %lld, data %p)",
+    msg(L_DEBUG, "\t\t%p (fd %d, rh %p, wh %p, eh %p, expires %lld, data %p)",
        fi, fi->fd, fi->read_handler, fi->write_handler, fi->error_handler,
        (long long)(fi->timer.expires ? fi->timer.expires-main_now : 999999), fi->data);
-  log(L_DEBUG, "\tActive hooks:");
+  msg(L_DEBUG, "\tActive hooks:");
   struct main_hook *ho;
   CLIST_WALK(ho, main_hook_list)
-    log(L_DEBUG, "\t\t%p (func %p, data %p)", ho, ho->handler, ho->data);
-  log(L_DEBUG, "\tActive processes:");
+    msg(L_DEBUG, "\t\t%p (func %p, data %p)", ho, ho->handler, ho->data);
+  msg(L_DEBUG, "\tActive processes:");
   struct main_process *pr;
   CLIST_WALK(pr, main_process_list)
-    log(L_DEBUG, "\t\t%p (pid %d, data %p)", pr, pr->pid, pr->data);
+    msg(L_DEBUG, "\t\t%p (pid %d, data %p)", pr, pr->pid, pr->data);
 #endif
 }
 
diff --git a/lib/math.h b/lib/math.h
deleted file mode 100644 (file)
index f891a21..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- *     UCW Library -- Stub for including math.h, avoiding name collisions
- *
- *     (c) 2003 Martin Mares <mj@ucw.cz>
- *
- *     This software may be freely distributed and used according to the terms
- *     of the GNU Lesser General Public License.
- */
-
-#undef log
-#define log libm_log
-#define exception math_exception
-#include <math.h>
-#undef log
-#define log log_msg
-#undef exception
-
-#ifdef CONFIG_LINUX
-float logf(float);
-#endif
index acf0bb1e45f074cdcc9988c700bddca4c95b4bd7..095925df54754085cfa9a4365ac378c7d2c03361 100644 (file)
@@ -291,14 +291,14 @@ qache_open_existing(struct qache *q, struct qache_params *par)
     goto unlock_and_fail;
 
   qache_unlock(q, 0);
-  log(L_INFO, "Cache %s: using existing data", q->file_name);
+  msg(L_INFO, "Cache %s: using existing data", q->file_name);
   return 1;
 
  unlock_and_fail:
   qache_unlock(q, 0);
   munmap(q->mmap_data, q->file_size);
  close_and_fail:
-  log(L_INFO, "Cache %s: ignoring old contents (%s)", q->file_name, err);
+  msg(L_INFO, "Cache %s: ignoring old contents (%s)", q->file_name, err);
   close(q->fd);
   return 0;
 }
@@ -370,7 +370,7 @@ qache_create(struct qache *q, struct qache_params *par)
 
   ASSERT(btell(fb) == (sh_off_t)par->cache_size);
   bclose(fb);
-  log(L_INFO, "Cache %s: created (%d bytes, %d slots, %d buckets)", q->file_name, par->cache_size, h.max_entries, h.hash_size);
+  msg(L_INFO, "Cache %s: created (%d bytes, %d slots, %d buckets)", q->file_name, par->cache_size, h.max_entries, h.hash_size);
 
   if ((q->mmap_data = mmap(NULL, par->cache_size, PROT_READ | PROT_WRITE, MAP_SHARED, q->fd, 0)) == MAP_FAILED)
     die("Cache %s: mmap failed (%m)", par->file_name);
@@ -402,7 +402,7 @@ qache_close(struct qache *q, uns retain_data)
   munmap(q->mmap_data, q->file_size);
   close(q->fd);
   if (!retain_data && unlink(q->file_name) < 0)
-    log(L_ERROR, "Cache %s: unlink failed (%m)", q->file_name);
+    msg(L_ERROR, "Cache %s: unlink failed (%m)", q->file_name);
   xfree(q->file_name);
   xfree(q);
 }
@@ -702,26 +702,26 @@ qache_delete(struct qache *q, qache_key_t *key, uns pos_hint)
 void
 qache_debug(struct qache *q)
 {
-  log(L_DEBUG, "Cache %s: block_size=%d (%d data), num_blocks=%d (%d first data), %d slots, %d hash buckets",
+  msg(L_DEBUG, "Cache %s: block_size=%d (%d data), num_blocks=%d (%d first data), %d slots, %d hash buckets",
       q->file_name, q->hdr->block_size, q->hdr->block_size, q->hdr->num_blocks, q->hdr->first_data_block,
       q->hdr->max_entries, q->hdr->hash_size);
 
-  log(L_DEBUG, "Table of cache entries:");
-  log(L_DEBUG, "\tEntry\tLruPrev\tLruNext\tDataLen\tDataBlk\tHashNxt\tKey");
+  msg(L_DEBUG, "Table of cache entries:");
+  msg(L_DEBUG, "\tEntry\tLruPrev\tLruNext\tDataLen\tDataBlk\tHashNxt\tKey");
   for (uns e=0; e<q->hdr->max_entries; e++)
     {
       struct qache_entry *ent = &q->entry_table[e];
-      log(L_DEBUG, "\t%d\t%d\t%d\t%d\t%d\t%d\t%s", e, ent->lru_prev, ent->lru_next, ent->data_len,
+      msg(L_DEBUG, "\t%d\t%d\t%d\t%d\t%d\t%d\t%s", e, ent->lru_prev, ent->lru_next, ent->data_len,
          ent->first_data_block, ent->hash_next, format_key(&ent->key));
     }
 
-  log(L_DEBUG, "Hash table:");
+  msg(L_DEBUG, "Hash table:");
   for (uns h=0; h<q->hdr->hash_size; h++)
-    log(L_DEBUG, "\t%04x\t%d", h, q->hash_table[h]);
+    msg(L_DEBUG, "\t%04x\t%d", h, q->hash_table[h]);
 
-  log(L_DEBUG, "Next pointers:");
+  msg(L_DEBUG, "Next pointers:");
   for (uns blk=q->hdr->first_data_block; blk<q->hdr->num_blocks; blk++)
-    log(L_DEBUG, "\t%d\t%d", blk, q->next_table[blk]);
+    msg(L_DEBUG, "\t%d\t%d", blk, q->next_table[blk]);
 }
 
 void
index de32b9b60b04ea0b307a42b6c139ad9b23b3a9a2..c18dcab17e51e1b17c9eaf53410935ec93778660 100644 (file)
@@ -36,7 +36,7 @@ exec_command_v(const byte *cmd, va_list args)
   execv(cmd, argv);
   byte echo[256];
   echo_command_v(echo, sizeof(echo), cmd, args);
-  log(L_ERROR, "Cannot execute %s: %m", echo);
+  msg(L_ERROR, "Cannot execute %s: %m", echo);
   exit(255);
 }
 
@@ -46,7 +46,7 @@ run_command_v(const byte *cmd, va_list args)
   pid_t p = fork();
   if (p < 0)
     {
-      log(L_ERROR, "fork() failed: %m");
+      msg(L_ERROR, "fork() failed: %m");
       return 0;
     }
   else if (!p)
@@ -54,15 +54,15 @@ run_command_v(const byte *cmd, va_list args)
   else
     {
       int stat;
-      byte msg[EXIT_STATUS_MSG_SIZE];
+      byte status_msg[EXIT_STATUS_MSG_SIZE];
       p = waitpid(p, &stat, 0);
       if (p < 0)
        die("waitpid() failed: %m");
-      if (format_exit_status(msg, stat))
+      if (format_exit_status(status_msg, stat))
        {
          byte echo[256];
          echo_command_v(echo, sizeof(echo), cmd, args);
-         log(L_ERROR, "`%s' failed: %s", echo, msg);
+         msg(L_ERROR, "`%s' failed: %s", echo, status_msg);
          return 0;
        }
       return 1;
index def241f37a564c90e42149d4d8c93dd8e3565ade..67315c9eb4a8fb8900786e6a10aca7b486a3ff39 100644 (file)
@@ -29,14 +29,14 @@ main(int argc, char **argv)
   else
     log_init(argv[1]);
   if (argc > 3)
-    log(argv[2][0], argv[3]);
+    msg(argv[2][0], argv[3]);
   else
     while (fgets(buf, sizeof(buf), stdin))
       {
        c = strchr(buf, '\n');
        if (c)
          *c = 0;
-       log(argv[2][0], buf);
+       msg(argv[2][0], buf);
       }
   return 0;
 }
index 71fcff1ecc6cbe4011290d7dbfe4b899996e1ad3..eebd2206dfdee76c2d1ee10f84d3036f826cf954 100644 (file)
@@ -230,7 +230,7 @@ P(pass)(struct fastbuf **fb1, struct fastbuf **fb2
   bclose(in1);
   bclose(in2);
   if (sorter_trace)
-    log(L_INFO, "Pass %d: %d runs, %d+%d KB", sorter_pass_counter, run_count,
+    msg(L_INFO, "Pass %d: %d runs, %d+%d KB", sorter_pass_counter, run_count,
        (out1 ? (int)((btell(out1) + 1023) / 1024) : 0),
        (out2 ? (int)((btell(out2) + 1023) / 1024) : 0));
   *fb1 = P(flush_out)(out1);
@@ -300,7 +300,7 @@ P(presort)(struct fastbuf **fb1, struct fastbuf **fb2)
 
   bclose(in);
   if (sorter_trace)
-    log(L_INFO, "Pass 0: %d runs, %d+%d KB",
+    msg(L_INFO, "Pass 0: %d runs, %d+%d KB",
        run_count,
        (out1 ? (int)((btell(out1) + 1023) / 1024) : 0),
        (out2 ? (int)((btell(out2) + 1023) / 1024) : 0));
@@ -459,7 +459,7 @@ P(presort)(struct fastbuf **fb1, struct fastbuf **fb2)
 
   bclose(in);
   if (sorter_trace)
-    log(L_INFO, "Pass 0: %d runs (%d giants, %d splits), %d+%d KB",
+    msg(L_INFO, "Pass 0: %d runs (%d giants, %d splits), %d+%d KB",
        run_count, giant_count, split_count,
        (out1 ? (int)((btell(out1) + 1023) / 1024) : 0),
        (out2 ? (int)((btell(out2) + 1023) / 1024) : 0));
index 5faada81c7531a68333905c63e32f350b14af576..a4c9b05ad1ffdba615505e39950a9e943622d30b 100644 (file)
@@ -24,5 +24,5 @@ sync_dir(const byte *name)
   if (err >= 0)
     return;
  err:
-  log(L_ERROR, "Unable to sync directory %s: %m", name);
+  msg(L_ERROR, "Unable to sync directory %s: %m", name);
 }