mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 04:10:14 +01:00
glib-aux: add NM_VALUE_TYPE_NONE
We have NM_VALUE_TYPE_UNSPEC (with numeric value 1). NM_VALUE_TYPE_UNSPEC means that there is some undefined opaque type, that cannot be handled generically. But what we also need is NM_VALUE_TYPE_NONE (with numeric value 0) to express that no type was set.
This commit is contained in:
parent
c2e46b7786
commit
0a2711eaad
2 changed files with 8 additions and 0 deletions
|
|
@ -339,6 +339,7 @@ nm_value_type_to_json(NMValueType value_type, GString *gstr, gconstpointer p_fie
|
|||
case NM_VALUE_TYPE_STRING:
|
||||
nm_json_gstr_append_string(gstr, *((const char *const *) p_field));
|
||||
return;
|
||||
case NM_VALUE_TYPE_NONE:
|
||||
case NM_VALUE_TYPE_UNSPEC:
|
||||
break;
|
||||
}
|
||||
|
|
@ -368,6 +369,7 @@ nm_value_type_from_json(const NMJsonVt * vt,
|
|||
case NM_VALUE_TYPE_STRING:
|
||||
return (nm_jansson_json_as_string(vt, elem, out_val) > 0);
|
||||
|
||||
case NM_VALUE_TYPE_NONE:
|
||||
case NM_VALUE_TYPE_UNSPEC:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#define __NM_VALUE_TYPE_H__
|
||||
|
||||
typedef enum _nm_packed {
|
||||
NM_VALUE_TYPE_NONE = 0,
|
||||
NM_VALUE_TYPE_UNSPEC = 1,
|
||||
NM_VALUE_TYPE_BOOL = 2,
|
||||
NM_VALUE_TYPE_INT32 = 3,
|
||||
|
|
@ -90,6 +91,7 @@ nm_value_type_cmp(NMValueType value_type, gconstpointer p_a, gconstpointer p_b)
|
|||
return 0;
|
||||
case NM_VALUE_TYPE_STRING:
|
||||
return nm_strcmp0(*((const char *const *) p_a), *((const char *const *) p_b));
|
||||
case NM_VALUE_TYPE_NONE:
|
||||
case NM_VALUE_TYPE_UNSPEC:
|
||||
break;
|
||||
}
|
||||
|
|
@ -129,6 +131,7 @@ nm_value_type_copy(NMValueType value_type, gpointer dst, gconstpointer src)
|
|||
*((char **) dst) = g_strdup(*((const char *const *) src));
|
||||
}
|
||||
return;
|
||||
case NM_VALUE_TYPE_NONE:
|
||||
case NM_VALUE_TYPE_UNSPEC:
|
||||
break;
|
||||
}
|
||||
|
|
@ -169,6 +172,7 @@ nm_value_type_get_from_variant(NMValueType value_type,
|
|||
* clear how many bits we would need. */
|
||||
|
||||
/* fall-through */
|
||||
case NM_VALUE_TYPE_NONE:
|
||||
case NM_VALUE_TYPE_UNSPEC:
|
||||
break;
|
||||
}
|
||||
|
|
@ -198,6 +202,7 @@ nm_value_type_to_variant(NMValueType value_type, gconstpointer src)
|
|||
* clear how many bits we would need. */
|
||||
|
||||
/* fall-through */
|
||||
case NM_VALUE_TYPE_NONE:
|
||||
case NM_VALUE_TYPE_UNSPEC:
|
||||
break;
|
||||
}
|
||||
|
|
@ -225,6 +230,7 @@ nm_value_type_get_variant_type(NMValueType value_type)
|
|||
* clear how many bits we would need. */
|
||||
|
||||
/* fall-through */
|
||||
case NM_VALUE_TYPE_NONE:
|
||||
case NM_VALUE_TYPE_UNSPEC:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue