]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Remove the path tokenizer
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 15 May 2025 22:28:26 +0000 (16:28 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 15 May 2025 22:28:26 +0000 (16:28 -0600)
Seems it was obsoleted by URI normalization.

src/types/path.c
src/types/path.h

index 60ca4dc74f944145c0f091781e791eb60cdd9e74..8456b52d7a75c0d7e59e2df0b508f455e2df2999 100644 (file)
@@ -1,45 +1,9 @@
 #include "types/path.h"
 
-#include <errno.h>
-
 #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)
 {
index b0c5dedcd15e8a9851b3c724d939dd8f174164a0..95fafcad1d2258977f8d9dc91036d58f21f94359 100644 (file)
@@ -1,18 +1,6 @@
 #ifndef SRC_TYPES_PATH_H_
 #define SRC_TYPES_PATH_H_
 
-#include <stdbool.h>
-#include <stddef.h>
-
-// 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 *);