mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 02:00:15 +01:00
macros: add nm_sprintf_bufa()
This commit is contained in:
parent
1104110865
commit
cc99ab81f3
1 changed files with 11 additions and 0 deletions
|
|
@ -341,6 +341,17 @@ nm_decode_version (guint version, guint *major, guint *minor, guint *micro) {
|
|||
_buf; \
|
||||
})
|
||||
|
||||
#define nm_sprintf_bufa(n_elements, format, ...) \
|
||||
({ \
|
||||
char *_buf; \
|
||||
\
|
||||
G_STATIC_ASSERT (sizeof (char[MAX ((n_elements), 1)]) == (n_elements)); \
|
||||
_buf = g_alloca (n_elements); \
|
||||
g_snprintf (_buf, n_elements, \
|
||||
""format"", __VA_ARGS__); \
|
||||
_buf; \
|
||||
})
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif /* __NM_MACROS_INTERNAL_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue