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>
This commit is contained in:
parent
5aa2ea7db0
commit
8461513b9a
2
btrfs.c
2
btrfs.c
|
@ -71,7 +71,7 @@ static int parse_one_token(const char *arg, const struct cmd_group *grp,
|
|||
|
||||
rest = skip_prefix(arg, cmd->token);
|
||||
if (!rest) {
|
||||
if (!prefixcmp(cmd->token, arg)) {
|
||||
if (!string_has_prefix(cmd->token, arg)) {
|
||||
if (abbrev_cmd) {
|
||||
/*
|
||||
* If this is abbreviated, it is
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue