From: Tim Duesterhus Date: Mon, 5 Apr 2021 15:53:54 +0000 (+0200) Subject: MINOR: ist: Add `istappend(struct ist, char)` X-Git-Tag: v2.4-dev16~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=551eeaec91b9e9f288524ef5123c10b57bb2bf6f;p=thirdparty%2Fhaproxy.git MINOR: ist: Add `istappend(struct ist, char)` This function appends the given char to the given `ist` and returns the resulting `ist`. --- diff --git a/include/import/ist.h b/include/import/ist.h index 1262e8f599..3f63ed2dda 100644 --- a/include/import/ist.h +++ b/include/import/ist.h @@ -407,6 +407,16 @@ static inline int istneq(const struct ist ist1, const struct ist ist2, size_t co return isteq(l, r); } +/* appends after . The caller must ensure that the underlying buffer + * is large enough to fit the character. + */ +static inline struct ist istappend(struct ist dst, const char src) +{ + dst.ptr[dst.len++] = src; + + return dst; +} + /* copies over for a maximum of bytes. Returns the number * of characters copied (src.len), or -1 if it does not fit. In all cases, the * contents are copied prior to reporting an error, so that the destination