aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/sort.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2019-09-02 23:38:48 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2019-09-02 23:51:15 +0200
commit4763814c683c50f8a3697b74e764f19c3dacccd5 (patch)
tree386ff43f024705a32310b882f2161b5f86d8820a /src/common/sort.c
parentc12bdb94ecdc44f200a8030dfde4a5ec46053ea6 (diff)
downloadblogc-feature/squareball.tar.gz
blogc-feature/squareball.tar.bz2
blogc-feature/squareball.zip
migrate codebase to use squareball. again :)feature/squareball
Diffstat (limited to 'src/common/sort.c')
-rw-r--r--src/common/sort.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/common/sort.c b/src/common/sort.c
deleted file mode 100644
index 3e24706..0000000
--- a/src/common/sort.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * blogc: A blog compiler.
- * Copyright (C) 2014-2019 Rafael G. Martins <rafael@rafaelmartins.eng.br>
- *
- * This program can be distributed under the terms of the BSD License.
- * See the file LICENSE.
- */
-
-#include <stdbool.h>
-#include "utils.h"
-#include "sort.h"
-
-
-bc_slist_t*
-bc_slist_sort(bc_slist_t *l, bc_sort_func_t cmp)
-{
- if (l == NULL) {
- return NULL;
- }
-
- bool swapped = false;
- bc_slist_t *lptr = NULL;
- bc_slist_t *rptr = NULL;
-
- do {
- swapped = false;
- lptr = l;
-
- while (lptr->next != rptr) {
- if (0 < cmp(lptr->data, lptr->next->data)) {
- void *tmp = lptr->data;
- lptr->data = lptr->next->data;
- lptr->next->data = tmp;
- swapped = true;
- }
-
- lptr = lptr->next;
- }
-
- rptr = lptr;
- } while(swapped);
-
- return l;
-}