diff options
| author | Burt P <pburt0@gmail.com> | 2017-05-30 16:48:27 -0500 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2017-06-04 16:23:46 -0700 | 
| commit | c4a8bcdd98b7c9d8af86d6000a898ed3b2a07720 (patch) | |
| tree | 8f807d11e89ae54ec232179c038180ca8b0ea7ef /modules/devices/x86 | |
| parent | bbdf08f7f13d93cb58ff62842a1da2bcfc382b37 (diff) | |
g_strv_contains() requires glib>2.44, not available in current Debian
Use own _g_strv_contains().
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/devices/x86')
| -rw-r--r-- | modules/devices/x86/processor.c | 16 | 
1 files changed, 13 insertions, 3 deletions
| diff --git a/modules/devices/x86/processor.c b/modules/devices/x86/processor.c index 1af96039..04db2423 100644 --- a/modules/devices/x86/processor.c +++ b/modules/devices/x86/processor.c @@ -213,16 +213,26 @@ fail:      g_free(endpoint);  } +static gboolean _g_strv_contains(const gchar * const * strv, const gchar *str) { +    /* g_strv_contains() requires glib>2.44 */ +    //return g_strv_contains(strv, str); +    gint i = 0; +    while(strv[i] != NULL) { +        if (g_strcmp0(strv[i], str) == 0) +            return 1; +        i++; +    } +    return 0; +} +  int processor_has_flag(gchar * strflags, gchar * strflag)  {      gchar **flags;      gint ret = 0; -      if (strflags == NULL || strflag == NULL)          return 0; -      flags = g_strsplit(strflags, " ", 0); -    ret = g_strv_contains((const gchar * const *)flags, strflag); +    ret = _g_strv_contains((const gchar * const *)flags, strflag);      g_strfreev(flags);      return ret;  } | 
