lib: Substitute some STREQLEN with STRPREFIX

There are few cases where STREQLEN() is called like this:

  STREQLEN(var, string, strlen(string))

which is the same as STRPREFIX(var, string). Use STRPREFIX()
because it is more obvious what the check is doing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Michal Privoznik
2021-01-26 17:06:50 +01:00
parent 0ad938adc0
commit d3b2d5158a
3 changed files with 7 additions and 8 deletions

View File

@@ -2568,7 +2568,6 @@ static char **
vshReadlineCommandGenerator(const char *text)
{
size_t grp_list_index = 0, cmd_list_index = 0;
size_t len = strlen(text);
const char *name;
const vshCmdGrp *grp;
const vshCmdDef *cmds;
@@ -2588,7 +2587,7 @@ vshReadlineCommandGenerator(const char *text)
if (cmds[cmd_list_index++].flags & VSH_CMD_FLAG_ALIAS)
continue;
if (STREQLEN(name, text, len)) {
if (STRPREFIX(name, text)) {
if (VIR_REALLOC_N(ret, ret_size + 2) < 0) {
g_strfreev(ret);
return NULL;