X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fhelper%2Flog.c;h=f9807747b5f4f780743e2d871f9ace0022b2cb18;hb=7a3eec2b4d9dbb9533acfb271dbe91afa0727c8e;hp=49b9bd98f63bedad2ba8948f7ed69b23d7918e39;hpb=3ee81fd78760b2a7b6e70663f22045706bbcd65a;p=openocd.git diff --git a/src/helper/log.c b/src/helper/log.c index 49b9bd98f6..f9807747b5 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -61,50 +61,20 @@ static const char * const log_strings[6] = { static int count; -static struct store_log_forward *log_head; -static int log_forward_count; - -struct store_log_forward { - struct store_log_forward *next; - const char *file; - int line; - const char *function; - const char *string; -}; - -/* either forward the log to the listeners or store it for possible forwarding later */ +/* forward the log to the listeners */ static void log_forward(const char *file, unsigned line, const char *function, const char *string) { - if (log_forward_count == 0) { - struct log_callback *cb, *next; - cb = log_callbacks; - /* DANGER!!!! the log callback can remove itself!!!! */ - while (cb) { - next = cb->next; - cb->fn(cb->priv, file, line, function, string); - cb = next; - } - } else { - struct store_log_forward *log = malloc(sizeof(struct store_log_forward)); - log->file = strdup(file); - log->line = line; - log->function = strdup(function); - log->string = strdup(string); - log->next = NULL; - if (log_head == NULL) - log_head = log; - else { - /* append to tail */ - struct store_log_forward *t; - t = log_head; - while (t->next != NULL) - t = t->next; - t->next = log; - } + struct log_callback *cb, *next; + cb = log_callbacks; + /* DANGER!!!! the log callback can remove itself!!!! */ + while (cb) { + next = cb->next; + cb->fn(cb->priv, file, line, function, string); + cb = next; } } -/* The log_puts() serves to somewhat different goals: +/* The log_puts() serves two somewhat different goals: * * - logging * - feeding low-level info to the user in GDB or Telnet