[virt-tools-list] [osinfo PATCH] Use g_str_has_suffix instead of opencoding it
Daniel P. Berrange
berrange at redhat.com
Fri Jan 6 11:29:57 UTC 2012
On Fri, Jan 06, 2012 at 02:16:09PM +0400, Christophe Fergeau wrote:
> ---
> osinfo/osinfo_loader.c | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
> index cf176a2..130472a 100644
> --- a/osinfo/osinfo_loader.c
> +++ b/osinfo/osinfo_loader.c
> @@ -1070,7 +1070,6 @@ osinfo_loader_process_file(OsinfoLoader *loader,
> GFile *file,
> GError **err)
> {
> - size_t len;
> GFileInfo *info = g_file_query_info(file,
> "standard::*",
> G_FILE_QUERY_INFO_NONE,
> @@ -1088,8 +1087,7 @@ osinfo_loader_process_file(OsinfoLoader *loader,
>
> switch (type) {
> case G_FILE_TYPE_REGULAR:
> - len = strlen(name);
> - if (strcmp(name + len - 4, ".xml") == 0)
> + if (g_str_has_suffix(name, ".xml"))
> osinfo_loader_process_file_reg_xml(loader, file, info, err);
> else if (strcmp(name, "usb.ids") == 0)
> osinfo_loader_process_file_reg_usb(loader, file, info, err);
ACK
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the virt-tools-list
mailing list