Make streq() and strcaseeq() static inline functions so they can be used as callbacks
This commit is contained in:
@@ -624,7 +624,7 @@ static gboolean need_secrets(NMVPNPlugin *plugin, NMConnection *connection,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if streq(method, "smartcard")
|
else if (streq(method, "smartcard"))
|
||||||
{
|
{
|
||||||
if (nm_setting_vpn_get_secret(settings, "password"))
|
if (nm_setting_vpn_get_secret(settings, "password"))
|
||||||
{
|
{
|
||||||
|
|||||||
+31
-25
@@ -52,9 +52,33 @@
|
|||||||
#define BUF_LEN 512
|
#define BUF_LEN 512
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro compares two strings for equality
|
* General purpose boolean type.
|
||||||
*/
|
*/
|
||||||
#define streq(x,y) (strcmp(x, y) == 0)
|
#ifdef HAVE_STDBOOL_H
|
||||||
|
# include <stdbool.h>
|
||||||
|
#else
|
||||||
|
# ifndef HAVE__BOOL
|
||||||
|
# define _Bool signed char
|
||||||
|
# endif /* HAVE__BOOL */
|
||||||
|
# define bool _Bool
|
||||||
|
# define false 0
|
||||||
|
# define true 1
|
||||||
|
# define __bool_true_false_are_defined 1
|
||||||
|
#endif /* HAVE_STDBOOL_H */
|
||||||
|
#ifndef FALSE
|
||||||
|
# define FALSE false
|
||||||
|
#endif /* FALSE */
|
||||||
|
#ifndef TRUE
|
||||||
|
# define TRUE true
|
||||||
|
#endif /* TRUE */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function that compares two strings for equality
|
||||||
|
*/
|
||||||
|
static inline bool streq(const char *x, const char *y)
|
||||||
|
{
|
||||||
|
return strcmp(x, y) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro compares two strings for equality, length limited
|
* Macro compares two strings for equality, length limited
|
||||||
@@ -62,9 +86,12 @@
|
|||||||
#define strneq(x,y,len) (strncmp(x, y, len) == 0)
|
#define strneq(x,y,len) (strncmp(x, y, len) == 0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro compares two strings for equality ignoring case
|
* Helper function that compares two strings for equality ignoring case
|
||||||
*/
|
*/
|
||||||
#define strcaseeq(x,y) (strcasecmp(x, y) == 0)
|
static inline bool strcaseeq(const char *x, const char *y)
|
||||||
|
{
|
||||||
|
return strcasecmp(x, y) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro compares two strings for equality ignoring case, length limited
|
* Macro compares two strings for equality ignoring case, length limited
|
||||||
@@ -202,27 +229,6 @@ static inline char *strdupnull(const char *s)
|
|||||||
*/
|
*/
|
||||||
#define TIME_32_BIT_SIGNED_MAX 0x7fffffff
|
#define TIME_32_BIT_SIGNED_MAX 0x7fffffff
|
||||||
|
|
||||||
/**
|
|
||||||
* General purpose boolean type.
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_STDBOOL_H
|
|
||||||
# include <stdbool.h>
|
|
||||||
#else
|
|
||||||
# ifndef HAVE__BOOL
|
|
||||||
# define _Bool signed char
|
|
||||||
# endif /* HAVE__BOOL */
|
|
||||||
# define bool _Bool
|
|
||||||
# define false 0
|
|
||||||
# define true 1
|
|
||||||
# define __bool_true_false_are_defined 1
|
|
||||||
#endif /* HAVE_STDBOOL_H */
|
|
||||||
#ifndef FALSE
|
|
||||||
# define FALSE false
|
|
||||||
#endif /* FALSE */
|
|
||||||
#ifndef TRUE
|
|
||||||
# define TRUE true
|
|
||||||
#endif /* TRUE */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define some missing fixed width int types on OpenSolaris.
|
* define some missing fixed width int types on OpenSolaris.
|
||||||
* TODO: since the uintXX_t types are defined by the C99 standard we should
|
* TODO: since the uintXX_t types are defined by the C99 standard we should
|
||||||
|
|||||||
Reference in New Issue
Block a user