summaryrefslogtreecommitdiff
path: root/src/basic/string-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-02-04 03:21:08 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-02-09 14:22:54 +0900
commite5bc5f1f5ac3595bfbe77d4896d6b7b22a0310a8 (patch)
treeebf3a88d73ad0a49008c9a441a58ad387702e900 /src/basic/string-util.c
parent5f33b2300b1ce7749a686dd1699ea0818b45857c (diff)
downloadsystemd-e5bc5f1f5ac3595bfbe77d4896d6b7b22a0310a8.tar.gz
fundamental: move several macros and functions into src/fundamental/
sd-boot has a copy of a subset of codes from libbasic. This makes sd-boot share the code with libbasic, and dedup the code. Note, startswith_no_case() is dropped from sd-boot, as - it is not used, - the previous implementation is not correct, - gnu-efi does not have StrniCmp() or so.
Diffstat (limited to 'src/basic/string-util.c')
-rw-r--r--src/basic/string-util.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/basic/string-util.c b/src/basic/string-util.c
index 3f663e4ac0..7f7122c1f1 100644
--- a/src/basic/string-util.c
+++ b/src/basic/string-util.c
@@ -20,64 +20,6 @@
#include "utf8.h"
#include "util.h"
-int strcmp_ptr(const char *a, const char *b) {
- /* Like strcmp(), but tries to make sense of NULL pointers */
-
- if (a && b)
- return strcmp(a, b);
- return CMP(a, b); /* Direct comparison of pointers, one of which is NULL */
-}
-
-int strcasecmp_ptr(const char *a, const char *b) {
- /* Like strcasecmp(), but tries to make sense of NULL pointers */
-
- if (a && b)
- return strcasecmp(a, b);
- return CMP(a, b); /* Direct comparison of pointers, one of which is NULL */
-}
-
-char* endswith(const char *s, const char *postfix) {
- size_t sl, pl;
-
- assert(s);
- assert(postfix);
-
- sl = strlen(s);
- pl = strlen(postfix);
-
- if (pl == 0)
- return (char*) s + sl;
-
- if (sl < pl)
- return NULL;
-
- if (memcmp(s + sl - pl, postfix, pl) != 0)
- return NULL;
-
- return (char*) s + sl - pl;
-}
-
-char* endswith_no_case(const char *s, const char *postfix) {
- size_t sl, pl;
-
- assert(s);
- assert(postfix);
-
- sl = strlen(s);
- pl = strlen(postfix);
-
- if (pl == 0)
- return (char*) s + sl;
-
- if (sl < pl)
- return NULL;
-
- if (strcasecmp(s + sl - pl, postfix) != 0)
- return NULL;
-
- return (char*) s + sl - pl;
-}
-
char* first_word(const char *s, const char *word) {
size_t sl, wl;
const char *p;