libnm: don't return deep-copied strv array from nm_tc_qdisc_get_attribute_names()
Most of the caller won't require a deep-clone of the attribute
names. Likely, the fetch the name, so they can lookup the attributes.
In that common case, there is no need to clone the strings themself.
(cherry picked from commit 01e7cb11bf
)
This commit is contained in:
@@ -327,19 +327,17 @@ nm_tc_qdisc_get_parent (NMTCQdisc *qdisc)
|
|||||||
*
|
*
|
||||||
* Gets an array of attribute names defined on @qdisc.
|
* Gets an array of attribute names defined on @qdisc.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): a %NULL-terminated array of attribute names,
|
* Returns: (transfer container): a %NULL-terminated array of attribute names
|
||||||
|
* or %NULL if no attributes are set.
|
||||||
*
|
*
|
||||||
* Since: 1.18
|
* Since: 1.18
|
||||||
**/
|
**/
|
||||||
char **
|
const char **
|
||||||
nm_tc_qdisc_get_attribute_names (NMTCQdisc *qdisc)
|
nm_tc_qdisc_get_attribute_names (NMTCQdisc *qdisc)
|
||||||
{
|
{
|
||||||
const char **names;
|
|
||||||
|
|
||||||
g_return_val_if_fail (qdisc, NULL);
|
g_return_val_if_fail (qdisc, NULL);
|
||||||
|
|
||||||
names = nm_utils_strdict_get_keys (qdisc->attributes, TRUE, NULL);
|
return nm_utils_strdict_get_keys (qdisc->attributes, TRUE, NULL);
|
||||||
return nm_utils_strv_make_deep_copied_nonnull (names);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GHashTable *
|
GHashTable *
|
||||||
|
@@ -60,7 +60,7 @@ NM_AVAILABLE_IN_1_12
|
|||||||
guint32 nm_tc_qdisc_get_parent (NMTCQdisc *qdisc);
|
guint32 nm_tc_qdisc_get_parent (NMTCQdisc *qdisc);
|
||||||
|
|
||||||
NM_AVAILABLE_IN_1_18
|
NM_AVAILABLE_IN_1_18
|
||||||
char**nm_tc_qdisc_get_attribute_names (NMTCQdisc *qdisc);
|
const char **nm_tc_qdisc_get_attribute_names (NMTCQdisc *qdisc);
|
||||||
NM_AVAILABLE_IN_1_18
|
NM_AVAILABLE_IN_1_18
|
||||||
GVariant *nm_tc_qdisc_get_attribute (NMTCQdisc *qdisc,
|
GVariant *nm_tc_qdisc_get_attribute (NMTCQdisc *qdisc,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
Reference in New Issue
Block a user