mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-24 11:44:48 +00:00
macros: add macro _nm_printf() for function attribute
This commit is contained in:
parent
466bf2f633
commit
348e505b3a
|
@ -74,7 +74,7 @@ void nmc_terminal_show_progress (const char *str);
|
||||||
const char *nmc_term_color_sequence (NmcTermColor color);
|
const char *nmc_term_color_sequence (NmcTermColor color);
|
||||||
const char *nmc_term_format_sequence (NmcTermFormat format);
|
const char *nmc_term_format_sequence (NmcTermFormat format);
|
||||||
NmcTermColor nmc_term_color_parse_string (const char *str, GError **error);
|
NmcTermColor nmc_term_color_parse_string (const char *str, GError **error);
|
||||||
char *nmc_colorize (NmCli *nmc, NmcTermColor color, NmcTermFormat format, const char * fmt, ...) __attribute__((__format__ (__printf__, 4, 5)));
|
char *nmc_colorize (NmCli *nmc, NmcTermColor color, NmcTermFormat format, const char * fmt, ...) _nm_printf (4, 5);
|
||||||
void nmc_filter_out_colors_inplace (char *str);
|
void nmc_filter_out_colors_inplace (char *str);
|
||||||
char *nmc_filter_out_colors (const char *str);
|
char *nmc_filter_out_colors (const char *str);
|
||||||
char *nmc_get_user_input (const char *ask_str);
|
char *nmc_get_user_input (const char *ask_str);
|
||||||
|
|
|
@ -41,11 +41,11 @@ char *nmt_newt_locale_from_utf8 (const char *str_utf8);
|
||||||
int nmt_newt_text_width (const char *str);
|
int nmt_newt_text_width (const char *str);
|
||||||
|
|
||||||
void nmt_newt_message_dialog (const char *message,
|
void nmt_newt_message_dialog (const char *message,
|
||||||
...) __attribute__((__format__ (__printf__, 1, 2)));
|
...) _nm_printf (1, 2);
|
||||||
int nmt_newt_choice_dialog (const char *button1,
|
int nmt_newt_choice_dialog (const char *button1,
|
||||||
const char *button2,
|
const char *button2,
|
||||||
const char *message,
|
const char *message,
|
||||||
...) __attribute__((__format__ (__printf__, 3, 4)));
|
...) _nm_printf (3, 4);
|
||||||
|
|
||||||
char *nmt_newt_edit_string (const char *data);
|
char *nmt_newt_edit_string (const char *data);
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#define _nm_unused __attribute__ ((unused))
|
#define _nm_unused __attribute__ ((unused))
|
||||||
#define _nm_pure __attribute__ ((pure))
|
#define _nm_pure __attribute__ ((pure))
|
||||||
#define _nm_const __attribute__ ((const))
|
#define _nm_const __attribute__ ((const))
|
||||||
|
#define _nm_printf(a,b) __attribute__ ((__format__ (__printf__, a, b)))
|
||||||
|
|
||||||
#define nm_auto(fcn) __attribute__ ((cleanup(fcn)))
|
#define nm_auto(fcn) __attribute__ ((cleanup(fcn)))
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ _nm_utils_strbuf_init (char *buf, gsize len, char **p_buf_ptr, gsize *p_buf_len)
|
||||||
G_STATIC_ASSERT (G_N_ELEMENTS (buf) == sizeof (buf) && sizeof (buf) > sizeof (char *)); \
|
G_STATIC_ASSERT (G_N_ELEMENTS (buf) == sizeof (buf) && sizeof (buf) > sizeof (char *)); \
|
||||||
_nm_utils_strbuf_init ((buf), sizeof (buf), (p_buf_ptr), (p_buf_len)); \
|
_nm_utils_strbuf_init ((buf), sizeof (buf), (p_buf_ptr), (p_buf_len)); \
|
||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
void nm_utils_strbuf_append (char **buf, gsize *len, const char *format, ...) __attribute__((__format__ (__printf__, 3, 4)));
|
void nm_utils_strbuf_append (char **buf, gsize *len, const char *format, ...) _nm_printf (3, 4);
|
||||||
void nm_utils_strbuf_append_c (char **buf, gsize *len, char c);
|
void nm_utils_strbuf_append_c (char **buf, gsize *len, char c);
|
||||||
void nm_utils_strbuf_append_str (char **buf, gsize *len, const char *str);
|
void nm_utils_strbuf_append_str (char **buf, gsize *len, const char *str);
|
||||||
|
|
||||||
|
|
|
@ -478,7 +478,7 @@ nm_logging_get_level (NMLogDomain domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SYSTEMD_JOURNAL
|
#if SYSTEMD_JOURNAL
|
||||||
__attribute__((__format__ (__printf__, 4, 5)))
|
_nm_printf (4, 5)
|
||||||
static void
|
static void
|
||||||
_iovec_set_format (struct iovec *iov, gboolean *iov_free, int i, const char *format, ...)
|
_iovec_set_format (struct iovec *iov, gboolean *iov_free, int i, const char *format, ...)
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,7 +158,7 @@ void _nm_log_impl (const char *file,
|
||||||
NMLogDomain domain,
|
NMLogDomain domain,
|
||||||
int error,
|
int error,
|
||||||
const char *fmt,
|
const char *fmt,
|
||||||
...) __attribute__((__format__ (__printf__, 7, 8)));
|
...) _nm_printf (7, 8);
|
||||||
|
|
||||||
const char *nm_logging_level_to_string (void);
|
const char *nm_logging_level_to_string (void);
|
||||||
const char *nm_logging_domains_to_string (void);
|
const char *nm_logging_domains_to_string (void);
|
||||||
|
|
|
@ -84,7 +84,7 @@ void link_callback (NMPlatform *platform, NMPObjectType obj_type, int ifindex, N
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
int nmtstp_run_command (const char *format, ...) __attribute__((__format__ (__printf__, 1, 2)));
|
int nmtstp_run_command (const char *format, ...) _nm_printf (1, 2);
|
||||||
#define nmtstp_run_command_check(...) do { g_assert_cmpint (nmtstp_run_command (__VA_ARGS__), ==, 0); } while (0)
|
#define nmtstp_run_command_check(...) do { g_assert_cmpint (nmtstp_run_command (__VA_ARGS__), ==, 0); } while (0)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in a new issue