summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-11-02 13:02:38 -0400
committerpommicket <pommicket@gmail.com>2022-11-02 13:02:38 -0400
commit26d34216da04a2b91e65a0eeee9200ad808d48ce (patch)
treee9781ff976f16f1f5249ca679aa2c941a35eb03c /util.c
parentb63bd066bf06317e6637aa03369a75c018c1939f (diff)
(insufficiently tested) per-path settings
also fixed memory bug in path_full, yet again
Diffstat (limited to 'util.c')
-rw-r--r--util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/util.c b/util.c
index 71fce88..b36bcd4 100644
--- a/util.c
+++ b/util.c
@@ -237,7 +237,6 @@ static int qsort_with_context_cmp(const void *a, const void *b) {
}
static void qsort_with_context(void *base, size_t nmemb, size_t size, int (*compar)(void *, const void *, const void *), void *arg) {
- // @TODO(eventually): write this yourself
// just use global variables. hopefully we don't try to run this in something multithreaded!
qsort_ctx_arg = arg;
qsort_ctx_cmp = compar;
@@ -299,7 +298,7 @@ static void path_full(char const *dir, char const *relpath, char *abspath, size_
else
lastsep[0] = '\0';
} else {
- if (abspath[len - 1] != PATH_SEPARATOR)
+ if (len == 0 || abspath[len - 1] != PATH_SEPARATOR)
str_cat(abspath, abspath_size, PATH_SEPARATOR_STR);
strn_cat(abspath, abspath_size, relpath, component_len);
}