libnm/trivial: move code

Move nm_lldp_neighbor_get_attr_value() first. The other functions are all redundant
and should possibly be deprecated.
This commit is contained in:
Thomas Haller 2021-03-11 11:00:11 +01:00
parent be40c8fdf7
commit 626a83d025
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 26 additions and 25 deletions

View file

@ -2956,6 +2956,27 @@ nm_lldp_neighbor_unref(NMLldpNeighbor *neighbor)
}
}
/**
* nm_lldp_neighbor_get_attr_value:
* @neighbor: the #NMLldpNeighbor
* @name: the attribute name
*
* Gets the value (as a GVariant) of attribute with name @name on @neighbor
*
* Returns: (transfer none): the value or %NULL if the attribute with @name was
* not found.
*
* Since: 1.18
**/
GVariant *
nm_lldp_neighbor_get_attr_value(NMLldpNeighbor *neighbor, const char *name)
{
g_return_val_if_fail(NM_IS_LLDP_NEIGHBOR(neighbor), FALSE);
g_return_val_if_fail(name && name[0], FALSE);
return g_hash_table_lookup(neighbor->attrs, name);
}
/**
* nm_lldp_neighbor_get_attr_names:
* @neighbor: the #NMLldpNeighbor
@ -3036,27 +3057,6 @@ nm_lldp_neighbor_get_attr_uint_value(NMLldpNeighbor *neighbor, const char *name,
return TRUE;
}
/**
* nm_lldp_neighbor_get_attr_value:
* @neighbor: the #NMLldpNeighbor
* @name: the attribute name
*
* Gets the value (as a GVariant) of attribute with name @name on @neighbor
*
* Returns: (transfer none): the value or %NULL if the attribute with @name was
* not found.
*
* Since: 1.18
**/
GVariant *
nm_lldp_neighbor_get_attr_value(NMLldpNeighbor *neighbor, const char *name)
{
g_return_val_if_fail(NM_IS_LLDP_NEIGHBOR(neighbor), FALSE);
g_return_val_if_fail(name && name[0], FALSE);
return g_hash_table_lookup(neighbor->attrs, name);
}
/**
* nm_lldp_neighbor_get_attr_type:
* @neighbor: the #NMLldpNeighbor

View file

@ -188,13 +188,16 @@ GType nm_device_get_setting_type(NMDevice *device);
NM_AVAILABLE_IN_1_2
GType nm_lldp_neighbor_get_type(void);
NM_AVAILABLE_IN_1_2
NMLldpNeighbor *nm_lldp_neighbor_new(void);
NM_AVAILABLE_IN_1_2
void nm_lldp_neighbor_ref(NMLldpNeighbor *neighbor);
NM_AVAILABLE_IN_1_2
void nm_lldp_neighbor_unref(NMLldpNeighbor *neighbor);
NM_AVAILABLE_IN_1_2
char **nm_lldp_neighbor_get_attr_names(NMLldpNeighbor *neighbor);
NM_AVAILABLE_IN_1_18
GVariant *nm_lldp_neighbor_get_attr_value(NMLldpNeighbor *neighbor, const char *name);
NM_AVAILABLE_IN_1_2
NMLldpNeighbor *nm_lldp_neighbor_new(void);
NM_AVAILABLE_IN_1_2
gboolean nm_lldp_neighbor_get_attr_string_value(NMLldpNeighbor *neighbor,
const char * name,
@ -204,8 +207,6 @@ gboolean
nm_lldp_neighbor_get_attr_uint_value(NMLldpNeighbor *neighbor, const char *name, guint *out_value);
NM_AVAILABLE_IN_1_2
const GVariantType *nm_lldp_neighbor_get_attr_type(NMLldpNeighbor *neighbor, const char *name);
NM_AVAILABLE_IN_1_18
GVariant *nm_lldp_neighbor_get_attr_value(NMLldpNeighbor *neighbor, const char *name);
G_END_DECLS