diff options
author | Thomas Haller <thaller@redhat.com> | 2021-06-28 17:02:52 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-07-12 13:34:35 +0200 |
commit | 0a2711eaad2a97ddd29a7e91908376a0f88573ce (patch) | |
tree | f0bafdeec7de4d0ff660d09b83dc7aefb389a9e1 | |
parent | c2e46b7786442cc5ce577d5f60588369625f300e (diff) | |
download | NetworkManager-0a2711eaad2a97ddd29a7e91908376a0f88573ce.tar.gz |
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.
-rw-r--r-- | src/libnm-glib-aux/nm-json-aux.h | 2 | ||||
-rw-r--r-- | src/libnm-glib-aux/nm-value-type.h | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/libnm-glib-aux/nm-json-aux.h b/src/libnm-glib-aux/nm-json-aux.h index 936e914641..b61c1f843a 100644 --- a/src/libnm-glib-aux/nm-json-aux.h +++ b/src/libnm-glib-aux/nm-json-aux.h @@ -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; } diff --git a/src/libnm-glib-aux/nm-value-type.h b/src/libnm-glib-aux/nm-value-type.h index 6156896c14..541797e9bf 100644 --- a/src/libnm-glib-aux/nm-value-type.h +++ b/src/libnm-glib-aux/nm-value-type.h @@ -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; } |