size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
{
    int len = strlen(dst);
    va_list vl;
    va_start(vl, fmt);
    len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
    va_end(vl);
    return len;
}
['static char *cat_header(char buf[], const char key[], const char value[])\n{\n    if (NOT_EMPTY(value)) {\n        int len = strlen(key) + strlen(value) + 5;\n        int is_first = !buf;\n        char *tmp = NULL;\n        if (buf)\n            len += strlen(buf);\n        if (!(tmp = av_realloc(buf, len))) {\n            av_freep(&buf);\n            return NULL;\n        } else {\n            buf = tmp;\n        }\n        if (is_first)\n            *buf = \'\\0\';\n        av_strlcatf(buf, len, "%s: %s\\r\\n", key, value);\n    }\n    return buf;\n}', 'size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)\n{\n    int len = strlen(dst);\n    va_list vl;\n    va_start(vl, fmt);\n    len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);\n    va_end(vl);\n    return len;\n}']