mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 08:48:07 +02:00
glib-aux/tests: add NMTST_COPY() helper
This commit is contained in:
parent
d422434945
commit
0f5ed15008
1 changed files with 13 additions and 0 deletions
|
|
@ -1458,6 +1458,19 @@ next:;
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* uses an expression statement to copy and return @arg. The use is for functions
|
||||
* like nmtst_inet4_from_string(), which return a static (thread-local) variable.
|
||||
* If you use such a statement twice, the result will be overwritten. The macro
|
||||
* prevents that. */
|
||||
#define NMTST_COPY(arg) \
|
||||
({ \
|
||||
typeof(arg) _arg = (arg); \
|
||||
\
|
||||
_arg; \
|
||||
})
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define __define_nmtst_static(NUM, SIZE) \
|
||||
static inline const char *nmtst_static_##SIZE##_##NUM(const char *str) \
|
||||
{ \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue