util: Rename virFileHasSuffix() to virStringHasCaseSuffix()

Despite its name, this is really just a general-purpose string
manipulation function, so it should be moved to the virstring
module and renamed accordingly.

In addition to the obvious s/File/String/, also tweak the name
to make it clear that the presence of the suffix is verified
using case-insensitive comparison.

A few trivial whitespace changes are squashed in.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Andrea Bolognani
2019-03-06 15:07:26 +01:00
parent ab2e90006d
commit 2de7dcba7e
15 changed files with 35 additions and 36 deletions

View File

@@ -41,7 +41,7 @@ static int
testSchemaFile(const void *args)
{
const struct testSchemaData *data = args;
bool shouldFail = virFileHasSuffix(data->xml_path, "-invalid.xml");
bool shouldFail = virStringHasCaseSuffix(data->xml_path, "-invalid.xml");
xmlDocPtr xml = NULL;
int ret = -1;
@@ -82,7 +82,7 @@ testSchemaDir(const char *schema,
return -1;
while ((rc = virDirRead(dir, &ent, dir_path)) > 0) {
if (!virFileHasSuffix(ent->d_name, ".xml"))
if (!virStringHasCaseSuffix(ent->d_name, ".xml"))
continue;
if (ent->d_name[0] == '.')
continue;