summaryrefslogtreecommitdiff
path: root/lib/time-util.c
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2013-08-29 15:50:17 +0100
committerSami Kerola <kerolasa@iki.fi>2013-08-29 18:14:08 +0100
commit199e939d88333162f440ea50b83415dac625c89c (patch)
tree33b50feb3b2a065311e3c1477971e728e1fffccc /lib/time-util.c
parent2659a49ef0ecb269b1dc41f06ad541a264bda795 (diff)
downloadutil-linux-199e939d88333162f440ea50b83415dac625c89c.tar.gz
lib/strutils: move *swith() functions to private library
Avoid code dublication in libmount and time-util. Proposed-by: Karel Zak <kzak@redhat.com> Reference: http://markmail.org/message/h7zexvqsieqngtmx Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'lib/time-util.c')
-rw-r--r--lib/time-util.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/lib/time-util.c b/lib/time-util.c
index c8fcc2a6..a0b27bf5 100644
--- a/lib/time-util.c
+++ b/lib/time-util.c
@@ -30,64 +30,6 @@
#define streq(a,b) (strcmp((a),(b)) == 0)
-static char *startswith(const char *s, const char *prefix)
-{
- const char *a, *b;
-
- assert(s);
- assert(prefix);
-
- a = s, b = prefix;
- for (;;) {
- if (*b == 0)
- return (char *)a;
- if (*a != *b)
- return NULL;
-
- a++, b++;
- }
-}
-
-static char *startswith_no_case(const char *s, const char *prefix)
-{
- const char *a, *b;
-
- assert(s);
- assert(prefix);
-
- a = s, b = prefix;
- for (;;) {
- if (*b == 0)
- return (char *)a;
- if (tolower(*a) != tolower(*b))
- return NULL;
-
- a++, b++;
- }
-}
-
-static 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;
-}
-
static int parse_sec(const char *t, usec_t *usec)
{
static const struct {