From: Alberto Leiva Popper Date: Thu, 15 May 2025 22:28:26 +0000 (-0600) Subject: Remove the path tokenizer X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a27b3f777a26fbff08edca2132b6e85e5c727b7e;p=thirdparty%2FFORT-validator.git Remove the path tokenizer Seems it was obsoleted by URI normalization. --- diff --git a/src/types/path.c b/src/types/path.c index 60ca4dc7..8456b52d 100644 --- a/src/types/path.c +++ b/src/types/path.c @@ -1,45 +1,9 @@ #include "types/path.h" -#include - #include "alloc.h" -#include "config.h" #include "log.h" #include "types/str.h" -/* These are arbitrary; feel free to change them. */ -#ifndef INITIAL_CAPACITY /* Unit tests want to override this */ -#define INITIAL_CAPACITY 128u -#endif -#define MAX_CAPACITY 4096u - -static bool -is_delimiter(char chara) -{ - return chara == '/' || chara == '\0'; -} - -void -token_init(struct tokenizer *tkn, char const *str) -{ - tkn->str = str; - tkn->len = 0; -} - -/* Like strtok_r(), but doesn't corrupt the string. */ -bool -token_next(struct tokenizer *tkn) -{ - tkn->str += tkn->len; - while (tkn->str[0] == '/') - tkn->str++; - if (tkn->str[0] == '\0') - return false; - for (tkn->len = 1; !is_delimiter(tkn->str[tkn->len]); tkn->len++) - ; - return true; -} - char const * path_filename(char const *path) { diff --git a/src/types/path.h b/src/types/path.h index b0c5dedc..95fafcad 100644 --- a/src/types/path.h +++ b/src/types/path.h @@ -1,18 +1,6 @@ #ifndef SRC_TYPES_PATH_H_ #define SRC_TYPES_PATH_H_ -#include -#include - -// XXX rename -struct tokenizer { - char const *str; - size_t len; -}; - -void token_init(struct tokenizer *, char const *); -bool token_next(struct tokenizer *tkn); - char const *path_filename(char const *); char *path_join(char const *, char const *);