summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-02-09 15:20:16 +0100
committerDavid Sterba <dsterba@suse.com>2017-03-08 13:00:47 +0100
commit1ffcc9b455b56899bd1f8a0c2d90f0e31eba7a20 (patch)
treefc948700ce45fd51e40ab6ed5d361d74de8c9435 /utils.c
parent2db52a6a481b26114a47299bfc21b2c33ab46e08 (diff)
btrfs-progs: move prefixcmp helper to utils
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index 5aab60d3..d2489e70 100644
--- a/utils.c
+++ b/utils.c
@@ -2305,6 +2305,15 @@ int string_is_numerical(const char *str)
return 1;
}
+int prefixcmp(const char *str, const char *prefix)
+{
+ for (; ; str++, prefix++)
+ if (!*prefix)
+ return 0;
+ else if (*str != *prefix)
+ return (unsigned char)*prefix - (unsigned char)*str;
+}
+
/* Subvolume helper functions */
/*
* test if name is a correct subvolume name