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) {