btrfs-progs: move prefixcmp helper to utils
[platform/upstream/btrfs-progs.git] / utils.c
diff --git a/utils.c b/utils.c
index 5aab60d..d2489e7 100644 (file)
--- 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