myMPD
Internal API documentation
Loading...
Searching...
No Matches
sort.h File Reference

Linked list merge sort implementation. More...

#include <stdbool.h>
Include dependency graph for sort.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef bool(* list_sort_callback) (struct t_list_node *current, struct t_list_node *next, enum list_sort_direction direction)

Enumerations

enum  list_sort_direction { LIST_SORT_ASC = 0 , LIST_SORT_DESC = 1 }

Functions

bool list_sort_by_callback (struct t_list *l, enum list_sort_direction direction, list_sort_callback sort_cb)
bool list_sort_by_value_i (struct t_list *l, enum list_sort_direction direction)
bool list_sort_by_value_p (struct t_list *l, enum list_sort_direction direction)
bool list_sort_by_key (struct t_list *l, enum list_sort_direction direction)

Detailed Description

Linked list merge sort implementation.

Typedef Documentation

◆ list_sort_callback

typedef bool(* list_sort_callback) (struct t_list_node *current, struct t_list_node *next, enum list_sort_direction direction)

Definition of sort callback

Enumeration Type Documentation

◆ list_sort_direction

Sort direction

Function Documentation

◆ list_sort_by_callback()

bool list_sort_by_callback ( struct t_list * l,
enum list_sort_direction direction,
list_sort_callback sort_cb )

The list sorting function. Uses bottom-up merge sort algorithm.

Parameters
lpointer to list to sort
directionsort direction
sort_cbcompare function
Returns
Always true

◆ list_sort_by_key()

bool list_sort_by_key ( struct t_list * l,
enum list_sort_direction direction )

Sorts the list by key. It uses the merge sort algorithm.

Parameters
lpointer to list to sort
directionsort direction
Returns
Always true

◆ list_sort_by_value_i()

bool list_sort_by_value_i ( struct t_list * l,
enum list_sort_direction direction )

Sorts the list by value_i. It uses the merge sort algorithm.

Parameters
lpointer to list to sort
directionsort direction
Returns
Always true

◆ list_sort_by_value_p()

bool list_sort_by_value_p ( struct t_list * l,
enum list_sort_direction direction )

Sorts the list by value_p. It uses the merge sort algorithm.

Parameters
lpointer to list to sort
directionsort direction
Returns
Always true