From c3a38bdbd9e08ba631f34faf408cfac8171dd725 Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Thu, 11 May 2023 17:07:30 +0200 Subject: Move string2.h inside src/ --- src/string2.h | 17 +++++++++++++++++ string2.h | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 src/string2.h delete mode 100644 string2.h diff --git a/src/string2.h b/src/string2.h new file mode 100644 index 0000000..228cc8e --- /dev/null +++ b/src/string2.h @@ -0,0 +1,17 @@ +/* See LICENSE file for copyright and license details. */ + +#ifndef __STRING2_H__ +#define __STRING2_H__ + +#include + +#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0) + +static int +strends(const char *str, const char *suffix) +{ + int offset = strlen(str) - strlen(suffix); + return offset < 0 ? 0 : strcmp(str + offset, suffix) == 0; +} + +#endif /* __STRING2_H__ */ diff --git a/string2.h b/string2.h deleted file mode 100644 index 228cc8e..0000000 --- a/string2.h +++ /dev/null @@ -1,17 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#ifndef __STRING2_H__ -#define __STRING2_H__ - -#include - -#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0) - -static int -strends(const char *str, const char *suffix) -{ - int offset = strlen(str) - strlen(suffix); - return offset < 0 ? 0 : strcmp(str + offset, suffix) == 0; -} - -#endif /* __STRING2_H__ */ -- cgit v1.2.3