ap

An audio player suited to my tastes
Log | Files | Refs | README | LICENSE

commit c46bf03a856acfff146c52fbe1a59eadccbb2127
parent 180a4506069b8e3c504bba7215d330ccdf78cf7d
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Mon,  3 Apr 2023 09:02:39 -0700

Fix bug in split function

When counting up the number of words before splitting, the issep
function wasn't supplied, yet it was when splitting. While the
current server always passes NULL anyway, that could change in the
future and cause issues.

Diffstat:
Maps/split.c | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/aps/split.c b/aps/split.c @@ -1,5 +1,5 @@ /* - * Copyright 2021, 2022 Jacob R. Edwards + * Copyright 2021-2023 Jacob R. Edwards * * ap -- audio player * @@ -17,19 +17,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include "util.h" - #include <ap/quote.h> #include <stdlib.h> #include <string.h> int -countsplits(char *s) +countsplits(char *s, int (*sep)(int)) { int n; - for (n = 0; apfindquote(&s, NULL); ++n) + for (n = 0; apfindquote(&s, sep); ++n) ; if (s) return -1; @@ -42,7 +40,7 @@ split(char *s, int (*sep)(int)) char **args, **ap; int len; - len = countsplits(s); + len = countsplits(s, sep); if (len < 0) return NULL;