提交 542da88f 编写于 作者: M Michael S. Tsirkin 提交者: Anthony Liguori

acpi-build: fix build on glib < 2.22

g_string_vprintf was only introduced in 2.24 so switch to vsnprintf
instead.  A bit uglier but name size is fixed at 4 bytes here so it's
easy.
Reported-by: NRichard Henderson <rth@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
Message-id: 1385036128-8753-1-git-send-email-mst@redhat.com
Signed-off-by: NAnthony Liguori <aliguori@amazon.com>
上级 0a3c7385
......@@ -287,16 +287,17 @@ static inline void build_append_array(GArray *array, GArray *val)
static void build_append_nameseg(GArray *array, const char *format, ...)
{
GString *s = g_string_new("");
/* It would be nicer to use g_string_vprintf but it's only there in 2.22 */
char s[] = "XXXX";
int len;
va_list args;
va_start(args, format);
g_string_vprintf(s, format, args);
len = vsnprintf(s, sizeof s, format, args);
va_end(args);
assert(s->len == 4);
g_array_append_vals(array, s->str, s->len);
g_string_free(s, true);
assert(len == 4);
g_array_append_vals(array, s, len);
}
/* 5.4 Definition Block Encoding */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册