diff options
| author | David Bremner <david@tethera.net> | 2016-07-15 07:25:41 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2016-08-09 09:34:11 +0900 |
| commit | 293186d6c6b1c4d158413de5412e6b4345e94970 (patch) | |
| tree | 483440c0ef66a669f559f2fe30273a965122f1f2 /lib/database.cc | |
| parent | f45fa5bdd397d52473f7092f7ae3e2ffb9b7aee5 (diff) | |
lib: provide _notmuch_database_log_append
_notmuch_database_log clears the log buffer each time. Rather than
introducing more complicated semantics about for this function, provide
a second function that does not clear the buffer. This is mainly a
convenience function for callers constructing complex or multi-line log
messages.
The changes to query.cc are to make sure that the common code path of
the new function is tested.
Diffstat (limited to 'lib/database.cc')
| -rw-r--r-- | lib/database.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/database.cc b/lib/database.cc index 66ee267f..57a98c94 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -383,6 +383,22 @@ _notmuch_database_log (notmuch_database_t *notmuch, talloc_free (notmuch->status_string); notmuch->status_string = talloc_vasprintf (notmuch, format, va_args); + va_end (va_args); +} + +void +_notmuch_database_log_append (notmuch_database_t *notmuch, + const char *format, + ...) +{ + va_list va_args; + + va_start (va_args, format); + + if (notmuch->status_string) + notmuch->status_string = talloc_vasprintf_append (notmuch->status_string, format, va_args); + else + notmuch->status_string = talloc_vasprintf (notmuch, format, va_args); va_end (va_args); } |
