Skip to content

Consolidate functions for sorting vectors #1785

@BenBE

Description

@BenBE

Currently there's Vector_quickSort, Vector_quickSortCustomCompare, and Vector_insertionSort for sorting vectors.

Apply the Highlander rule and let there only be one: Vector_sort.

While at it, update the signatures to allow for context support in the comparison functions:

typedef int (*Object_SortFn)(const void *a, const void *b, void *ctx);
int Vector_sort(Vector *v, Object_SortFn cmp, void *ctx);

Note: The single replacement API MUST be a stable sorting algorithm internally to conserve behaviour of Vector_insertionSort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions