diff options
author | Matus Fabian <matfabia@cisco.com> | 2015-12-14 10:31:33 -0500 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2015-12-15 00:09:46 +0100 |
commit | d2dc3df90d20419dfaee03f3096ed18d20fa391a (patch) | |
tree | 3315705df01fdb840ddb828fff779748154930b8 /vpp-japi/japi/vppjni.c | |
parent | f9bd620dc5299180cb639c4c6f91fadf6b860b08 (diff) |
replacing all vec_sort() invocations to vec_sort_with_function()
Change-Id: I05895827ed52be292112484cee7d0a2591b67335
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'vpp-japi/japi/vppjni.c')
-rw-r--r-- | vpp-japi/japi/vppjni.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/vpp-japi/japi/vppjni.c b/vpp-japi/japi/vppjni.c index 740a3425d90..4274c31dd91 100644 --- a/vpp-japi/japi/vppjni.c +++ b/vpp-japi/japi/vppjni.c @@ -362,6 +362,15 @@ out: return (rv); } +static int +name_sort_cmp (void * a1, void * a2) +{ + name_sort_t * n1 = a1; + name_sort_t * n2 = a2; + + return strcmp ((char *)n1->name, (char *)n2->name); +} + JNIEXPORT jstring JNICALL Java_org_openvpp_vppjapi_vppConn_getInterfaceList (JNIEnv * env, jobject obj, jstring name_filter) { @@ -387,8 +396,7 @@ JNIEXPORT jstring JNICALL Java_org_openvpp_vppjapi_vppConn_getInterfaceList } })); - vec_sort (nses, n1, n2, - strcmp ((char *)n1->name, (char *)n2->name)); + vec_sort_with_function (nses, name_sort_cmp); vec_foreach (ns, nses) s = format (s, "%s: %d, ", ns->name, ns->value); |