Add DohSortedKeys function

Returns a list of sorted keys in a DOH Hash.
This commit is contained in:
William S Fulton 2022-09-30 22:48:04 +01:00
commit 77b08daca7
4 changed files with 29 additions and 26 deletions

View file

@ -374,6 +374,18 @@ DOH *DohKeys(DOH *obj) {
return 0;
}
/* -----------------------------------------------------------------------------
* DohSortedKeys()
* ----------------------------------------------------------------------------- */
DOH *DohSortedKeys(DOH *obj, int (*cmp) (const DOH *, const DOH *)) {
DOHList *keys = DohKeys(obj);
if (keys) {
DohSortList(keys, cmp);
}
return keys;
}
/* -----------------------------------------------------------------------------
* DohGetInt()
* ----------------------------------------------------------------------------- */