aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicm <nicm>2018-01-18 14:28:11 +0000
committernicm <nicm>2018-01-18 14:28:11 +0000
commit17d4c39f24be7c22e1866d1587d77dcca7e6a2d8 (patch)
treea938d129559756fa09bbbc62d986a2116dc8dbba
parentc9037fde1c6fd1e32988951384d2a224591867f1 (diff)
downloadrtmux-17d4c39f24be7c22e1866d1587d77dcca7e6a2d8.tar.gz
rtmux-17d4c39f24be7c22e1866d1587d77dcca7e6a2d8.tar.bz2
rtmux-17d4c39f24be7c22e1866d1587d77dcca7e6a2d8.zip
Discard all but the last line when reading from a #() command - the
callback is just going to be fired again straight away to go through all the lines, it is better just to use the last one straight away.
-rw-r--r--format.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/format.c b/format.c
index 1b967c93..be53ad93 100644
--- a/format.c
+++ b/format.c
@@ -191,10 +191,15 @@ static void
format_job_update(struct job *job)
{
struct format_job *fj = job->data;
- char *line;
+ struct evbuffer *evb = job->event->input;
+ char *line = NULL, *next;
time_t t;
- if ((line = evbuffer_readline(job->event->input)) == NULL)
+ while ((next = evbuffer_readline(evb)) != NULL) {
+ free(line);
+ line = next;
+ }
+ if (line == NULL)
return;
fj->updated = 1;