diff options
author | pommicket <pommicket@gmail.com> | 2022-12-24 12:02:40 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-24 12:02:40 -0500 |
commit | a6a06900bf7206dc86017bbb1895272ebfac5418 (patch) | |
tree | 2f49cee6002d5d10bb4afc0db18425e5f5dfb38e /util.c | |
parent | 1c346f2aba30fcb581f20f2b67bd5e6adcb4a7e6 (diff) |
start LSP setting
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -80,6 +80,14 @@ static bool str_has_prefix(char const *str, char const *prefix) { return strncmp(str, prefix, strlen(prefix)) == 0; } +// e.g. "/usr/share/bla" has the path prefix "/usr/share" but not "/usr/sha" +static bool str_has_path_prefix(const char *path, const char *prefix) { + size_t prefix_len = strlen(prefix); + if (strncmp(path, prefix, prefix_len) != 0) + return false; + return path[prefix_len] == '\0' || strchr(ALL_PATH_SEPARATORS, path[prefix_len]); +} + static bool streq(char const *a, char const *b) { return strcmp(a, b) == 0; } |