cleanup: function attribute 'format'
[lttng-ust.git] / liblttng-ust / tracef.c
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2013-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 */
6
7 #define _LGPL_SOURCE
8 #include <stdio.h>
9 #include <ust-helper.h>
10
11 #define TRACEPOINT_CREATE_PROBES
12 #define TRACEPOINT_DEFINE
13 #include "lttng-ust-tracef-provider.h"
14
15 static inline
16 void __lttng_ust_vtracef(const char *fmt, va_list ap)
17 __attribute__((always_inline, format(printf, 1, 0)));
18 static inline
19 void __lttng_ust_vtracef(const char *fmt, va_list ap)
20 {
21 char *msg;
22 const int len = vasprintf(&msg, fmt, ap);
23
24 /* len does not include the final \0 */
25 if (len < 0)
26 goto end;
27 __tracepoint_cb_lttng_ust_tracef___event(msg, len,
28 LTTNG_UST_CALLER_IP());
29 free(msg);
30 end:
31 return;
32 }
33
34 void _lttng_ust_vtracef(const char *fmt, va_list ap)
35 __attribute__((format(printf, 1, 0)));
36 void _lttng_ust_vtracef(const char *fmt, va_list ap)
37 {
38 __lttng_ust_vtracef(fmt, ap);
39 }
40
41 void _lttng_ust_tracef(const char *fmt, ...)
42 __attribute__((format(printf, 1, 2)));
43 void _lttng_ust_tracef(const char *fmt, ...)
44 {
45 va_list ap;
46
47 va_start(ap, fmt);
48 __lttng_ust_vtracef(fmt, ap);
49 va_end(ap);
50 }
This page took 0.0304 seconds and 5 git commands to generate.