diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2021-03-14 15:51:18 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2021-03-20 00:17:40 +0000 |
commit | 4729b6937b582a029147ba51298f5c300c5b1891 (patch) | |
tree | ba5a64c98327fce7a3d894bc02c90031f8470a1d /src | |
parent | ee3c2fea18d0c940c2256c6bf041f546c703c375 (diff) |
Avoid needless alloc for null header
Diffstat (limited to 'src')
-rw-r--r-- | src/src/header.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/src/header.c b/src/src/header.c index cf7a81296..720446bff 100644 --- a/src/src/header.c +++ b/src/src/header.c @@ -97,12 +97,15 @@ header_add_backend(BOOL after, uschar *name, BOOL topnot, int type, header_line *h, *new = NULL; header_line **hptr; -uschar *p, *q; -uschar * buf = store_get(HEADER_ADD_BUFFER_SIZE, FALSE); -gstring gs = { .size = HEADER_ADD_BUFFER_SIZE, .ptr = 0, .s = buf }; +uschar * p, * q, * buf; +gstring gs; if (!header_last) return NULL; +gs.s = buf = store_get(HEADER_ADD_BUFFER_SIZE, FALSE); +gs.size = HEADER_ADD_BUFFER_SIZE; +gs.ptr = 0; + if (!string_vformat(&gs, SVFMT_REBUFFER, format, ap)) log_write(0, LOG_MAIN|LOG_PANIC_DIE, "string too long in header_add: " "%.100s ...", string_from_gstring(&gs)); |