Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / md / dm-vdo / string-utils.c
blob71e44b4683eafabe7b41d7fcfd8fc34cd94bee56
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright 2023 Red Hat
4 */
6 #include "string-utils.h"
8 char *vdo_append_to_buffer(char *buffer, char *buf_end, const char *fmt, ...)
10 va_list args;
11 size_t n;
13 va_start(args, fmt);
14 n = vsnprintf(buffer, buf_end - buffer, fmt, args);
15 if (n >= (size_t) (buf_end - buffer))
16 buffer = buf_end;
17 else
18 buffer += n;
19 va_end(args);
21 return buffer;