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:
David Sterba 2023-08-22 15:16:24 +02:00
parent 5aa2ea7db0
commit 8461513b9a
4 changed files with 4 additions and 6 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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)

View File

@ -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