aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2023-08-22 15:16:24 +0200
committerDavid Sterba <dsterba@suse.com>2023-08-28 17:24:24 +0200
commit8461513b9a984121944e844d73105605f62605e1 (patch)
tree86a14e6b0ae5fffff706cb24f97cadfeaecc4ab9 /common
parent5aa2ea7db09271aac2a4a280f933479d131866a6 (diff)
downloadbtrfs-progs-8461513b9a984121944e844d73105605f62605e1.tar.gz
btrfs-progs: rename prefixcmp to string_has_prefix
We already have the string_* namespace for such helpers. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'common')
-rw-r--r--common/help.c2
-rw-r--r--common/string-utils.c2
-rw-r--r--common/string-utils.h4
3 files changed, 3 insertions, 5 deletions
diff --git a/common/help.c b/common/help.c
index 9527fc3c..c75acf82 100644
--- a/common/help.c
+++ b/common/help.c
@@ -515,7 +515,7 @@ void help_ambiguous_token(const char *arg, const struct cmd_group *grp)
for (i = 0; grp->commands[i]; i++) {
const struct cmd_struct *cmd = grp->commands[i];
- if (!prefixcmp(cmd->token, arg))
+ if (!string_has_prefix(cmd->token, arg))
fprintf(stderr, "\t%s\n", cmd->token);
}
diff --git a/common/string-utils.c b/common/string-utils.c
index 62f2d0ed..e338afa7 100644
--- a/common/string-utils.c
+++ b/common/string-utils.c
@@ -34,7 +34,7 @@ int string_is_numerical(const char *str)
return 1;
}
-int prefixcmp(const char *str, const char *prefix)
+int string_has_prefix(const char *str, const char *prefix)
{
for (; ; str++, prefix++)
if (!*prefix)
diff --git a/common/string-utils.h b/common/string-utils.h
index 75a2cdb3..ade8fcd1 100644
--- a/common/string-utils.h
+++ b/common/string-utils.h
@@ -17,10 +17,8 @@
#ifndef __BTRFS_STRING_UTILS_H__
#define __BTRFS_STRING_UTILS_H__
-#include "kerncompat.h"
-
int string_is_numerical(const char *str);
-int prefixcmp(const char *str, const char *prefix);
+int string_has_prefix(const char *str, const char *prefix);
u64 arg_strtou64(const char *str);
#endif