diff options
author | Thomas Haller <thaller@redhat.com> | 2019-07-19 10:33:54 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-07-25 10:42:06 +0200 |
commit | a78ba1c33a40358ca52c91fc0163b7b6f898da41 (patch) | |
tree | b41fa7845c7251d38ead0f96dc0aa933c51bfdd6 /vapi | |
parent | 31d74e8b457380e6a9f46fca47f8fef8a56f7cb0 (diff) | |
download | NetworkManager-a78ba1c33a40358ca52c91fc0163b7b6f898da41.tar.gz |
shared: add nm_strcmp_with_data()
It is like strcmp(), but has a signature suitable for GCompareDataFunc.
This is necessary with nm_utils_ptrarray_find_binary_search()
to search a sorted strv array.
The fault is here really C, which doesn't allow inline static functions.
So, you need all kinds of slightly different flavors for the same
callbacks (with or without user-data).
Note that glib2 internally just casts strcmp() to GCompareDataFunc ([1]),
relying on the fact how arguments are passed to the function and
ignoring the additional user-data argument. But I find that really
ugly and probably not permissible in general C. Dunno whether POSIX
would guarantee for this to work. I'd rather not do such function
pointer casts.
[1] https://gitlab.gnome.org/GNOME/glib/blob/0c0cf59858abb3f8464bc55f596f9fbf599ac251/glib/garray.c#L1792
Diffstat (limited to 'vapi')
0 files changed, 0 insertions, 0 deletions