diff options
Diffstat (limited to 'src/sort.c')
-rw-r--r-- | src/sort.c | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -1,4 +1,4 @@ -/* grecs - Gray's Extensible Configuration System +/* argot - Gray's Extensible Configuration System Copyright (C) 2007-2016 Sergey Poznyakoff Grecs is free software; you can redistribute it and/or modify it @@ -18,14 +18,14 @@ # include <config.h> #endif #include <stdlib.h> -#include "grecs.h" +#include "argot.h" struct node_list { - struct grecs_node *head, *tail; + struct argot_node *head, *tail; }; static void -node_list_init(struct node_list *list, struct grecs_node *node) +node_list_init(struct node_list *list, struct argot_node *node) { if (node) { list->head = node; @@ -37,7 +37,7 @@ node_list_init(struct node_list *list, struct grecs_node *node) } static void -node_list_add(struct node_list *list, struct grecs_node *node) +node_list_add(struct node_list *list, struct argot_node *node) { node->next = NULL; node->prev = list->tail; @@ -63,10 +63,10 @@ node_list_join(struct node_list *a, struct node_list *b) static void _qsort_nodelist(struct node_list *list, - int (*compare)(struct grecs_node const *, - struct grecs_node const *)) + int (*compare)(struct argot_node const *, + struct argot_node const *)) { - struct grecs_node *cur, *middle; + struct argot_node *cur, *middle; struct node_list high_list, low_list; int rc; @@ -86,7 +86,7 @@ _qsort_nodelist(struct node_list *list, node_list_init(&low_list, NULL); node_list_init(&high_list, NULL); for (cur = list->head; cur; ) { - struct grecs_node *next = cur->next; + struct argot_node *next = cur->next; cur->next = NULL; if (compare(middle, cur) < 0) node_list_add(&high_list, cur); @@ -109,10 +109,10 @@ _qsort_nodelist(struct node_list *list, list->tail = low_list.tail; } -struct grecs_node * -grecs_nodelist_sort(struct grecs_node *node, - int (*compare)(struct grecs_node const *, - struct grecs_node const *)) +struct argot_node * +argot_nodelist_sort(struct argot_node *node, + int (*compare)(struct argot_node const *, + struct argot_node const *)) { struct node_list list; node_list_init(&list, node); @@ -121,14 +121,14 @@ grecs_nodelist_sort(struct grecs_node *node, } void -grecs_tree_sort(struct grecs_node *node, - int (*compare)(struct grecs_node const *, - struct grecs_node const *)) +argot_tree_sort(struct argot_node *node, + int (*compare)(struct argot_node const *, + struct argot_node const *)) { if (node && node->down) { - node->down = grecs_nodelist_sort(node->down, compare); + node->down = argot_nodelist_sort(node->down, compare); for (node = node->down; node; node = node->next) - grecs_tree_sort(node, compare); + argot_tree_sort(node, compare); } } |