libnm: drop unused internal API _nm_setting_gendata_reset_from_hash() and _nm_setting_gendata_to_gvalue()

This was intended for when the gendata hash should be converted
to/from a GValue/GHashTable. This would have been used, if
we also would have added a GObject property that exposes
the hash. But that was never done (at least not for NMSettingEthtool
and not yet).

This code is not used. If you ever need it, revert the patch
or implement it anew.
This commit is contained in:
Thomas Haller 2020-05-14 21:30:01 +02:00
parent 34fc68f20a
commit bfe05b48f2
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 0 additions and 71 deletions

View file

@ -322,12 +322,6 @@ guint _nm_setting_gendata_get_all (NMSetting *setting,
const char *const**out_names,
GVariant *const**out_values);
gboolean _nm_setting_gendata_reset_from_hash (NMSetting *setting,
GHashTable *new);
void _nm_setting_gendata_to_gvalue (NMSetting *setting,
GValue *value);
GVariant *nm_setting_gendata_get (NMSetting *setting,
const char *name);

View file

@ -2524,71 +2524,6 @@ nm_setting_gendata_get_all_names (NMSetting *setting,
return names;
}
void
_nm_setting_gendata_to_gvalue (NMSetting *setting,
GValue *value)
{
GenData *gendata;
GHashTable *new;
const char *key;
GVariant *val;
GHashTableIter iter;
nm_assert (NM_IS_SETTING (setting));
nm_assert (value);
nm_assert (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_HASH_TABLE));
new = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
gendata = _gendata_hash (setting, FALSE);
if (gendata) {
g_hash_table_iter_init (&iter, gendata->hash);
while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &val))
g_hash_table_insert (new, g_strdup (key), g_variant_ref (val));
}
g_value_take_boxed (value, new);
}
gboolean
_nm_setting_gendata_reset_from_hash (NMSetting *setting,
GHashTable *new)
{
GenData *gendata;
GHashTableIter iter;
const char *key;
GVariant *val;
guint num;
nm_assert (NM_IS_SETTING (setting));
nm_assert (new);
num = new ? g_hash_table_size (new) : 0;
gendata = _gendata_hash (setting, num > 0);
if (num == 0) {
if ( !gendata
|| g_hash_table_size (gendata->hash) == 0)
return FALSE;
g_hash_table_remove_all (gendata->hash);
_nm_setting_gendata_notify (setting, TRUE);
return TRUE;
}
/* let's not bother to find out whether the new hash has any different
* content the current gendata. Just replace it. */
g_hash_table_remove_all (gendata->hash);
if (num > 0) {
g_hash_table_iter_init (&iter, new);
while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &val))
g_hash_table_insert (gendata->hash, g_strdup (key), g_variant_ref (val));
}
_nm_setting_gendata_notify (setting, TRUE);
return TRUE;
}
gboolean
nm_setting_gendata_get_uint32 (NMSetting *setting,
const char *optname,