btrfs-progs: move prefixcmp helper to utils
authorDavid Sterba <dsterba@suse.com>
Thu, 9 Feb 2017 14:20:16 +0000 (15:20 +0100)
committerDavid Sterba <dsterba@suse.com>
Wed, 8 Mar 2017 12:00:47 +0000 (13:00 +0100)
Signed-off-by: David Sterba <dsterba@suse.com>
commands.h
help.c
utils.c
utils.h

index e719c49..01bf387 100644 (file)
@@ -65,9 +65,6 @@ struct cmd_group {
        const struct cmd_struct commands[];
 };
 
-/* btrfs.c */
-int prefixcmp(const char *str, const char *prefix);
-
 int handle_command_group(const struct cmd_group *grp, int argc,
                         char **argv);
 
diff --git a/help.c b/help.c
index b571804..19b0d35 100644 (file)
--- a/help.c
+++ b/help.c
@@ -359,12 +359,3 @@ void help_command_group(const struct cmd_group *grp, int argc, char **argv)
        usage_command_group(grp, full, 0);
 }
 
-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;
-}
-
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
diff --git a/utils.h b/utils.h
index 31ccbf0..24d0a20 100644 (file)
--- a/utils.h
+++ b/utils.h
@@ -146,6 +146,7 @@ int btrfs_tree_search2_ioctl_supported(int fd);
 
 unsigned int get_unit_mode_from_arg(int *argc, char *argv[], int df_mode);
 int string_is_numerical(const char *str);
+int prefixcmp(const char *str, const char *prefix);
 
 /*
  * Global program state, configurable by command line and available to