From f9125c38c0e9560649f9be6c4d6565ed8fc9fb6e Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Fri, 17 Apr 2015 22:10:43 +0200 Subject: degesch: prepare for printing to buffers --- degesch.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/degesch.c b/degesch.c index b1ec7fd..23e2ae1 100644 --- a/degesch.c +++ b/degesch.c @@ -789,9 +789,9 @@ buffer_send (struct app_context *ctx, struct buffer *buffer, line->type = type; line->flags = flags; line->when = time (NULL); - line->who = xstrdup (origin); + line->who = origin ? xstrdup (origin) : NULL; line->object = str_steal (&text); - line->reason = xstrdup (reason); + line->reason = reason ? xstrdup (reason) : NULL; LIST_APPEND_WITH_TAIL (buffer->lines, buffer->lines_tail, line); buffer->lines_count++; @@ -804,6 +804,11 @@ buffer_send (struct app_context *ctx, struct buffer *buffer, buffer_line_display (ctx, line); } +#define buffer_send_status(ctx, buffer, ...) \ + buffer_send (ctx, buffer, BUFFER_LINE_STATUS, 0, NULL, NULL, __VA_ARGS__) +#define buffer_send_error(ctx, buffer, ...) \ + buffer_send (ctx, buffer, BUFFER_LINE_ERROR, 0, NULL, NULL, __VA_ARGS__) + static struct buffer * buffer_by_name (struct app_context *ctx, const char *name) { -- cgit v1.2.3-70-g09d2