* tools/virsh.c: New macro vshStrcasecmp * tools/virsh-domain-monitor.c: Use vshStrcasecmp instead of strcasecmp * tools/virsh-snapshot.c: Likewise * cfg.mk: Only avoid doing strcase checking for virsh.c --- cfg.mk | 2 +- tools/virsh-domain-monitor.c | 2 +- tools/virsh-snapshot.c | 4 ++-- tools/virsh.c | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cfg.mk b/cfg.mk index c0457e7..1318593 100644 --- a/cfg.mk +++ b/cfg.mk @@ -727,7 +727,7 @@ $(srcdir)/src/remote/remote_client_bodies.h: $(srcdir)/src/remote/remote_protoco $(MAKE) -C src remote/remote_client_bodies.h # List all syntax-check exemptions: -exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh(-domain-monitor|-snapshot)?\.c$$ +exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh\.c$$ _src1=libvirt|fdstream|qemu/qemu_monitor|util/(command|util)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller exclude_file_name_regexp--sc_avoid_write = \ diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 151a8d0..ef8627e 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1273,7 +1273,7 @@ vshDomainSorter(const void *a, const void *b) idb = virDomainGetID(*db); if (ida == inactive && idb == inactive) - return strcasecmp(virDomainGetName(*da), virDomainGetName(*db)); + return vshStrcasecmp(virDomainGetName(*da), virDomainGetName(*db)); if (ida != inactive && idb != inactive) { if (ida > idb) diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index d6de3da..b1a7087 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -817,8 +817,8 @@ vshSnapSorter(const void *a, const void *b) return sb->snap != NULL; /* User visible sort, so we want locale-specific case comparison. */ - return strcasecmp(virDomainSnapshotGetName(sa->snap), - virDomainSnapshotGetName(sb->snap)); + return vshStrcasecmp(virDomainSnapshotGetName(sa->snap), + virDomainSnapshotGetName(sb->snap)); } /* Compute a list of snapshots from DOM. If FROM is provided, the diff --git a/tools/virsh.c b/tools/virsh.c index 6a5724d..a2674ae 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -357,6 +357,7 @@ static void vshDebug(vshControl *ctl, int level, const char *format, ...) /* XXX: add batch support */ #define vshPrint(_ctl, ...) vshPrintExtra(NULL, __VA_ARGS__) +#define vshStrcasecmp(S1, S2) strcasecmp(S1, S2) static int vshDomainState(vshControl *ctl, virDomainPtr dom, int *reason); static const char *vshDomainStateToString(int state); -- 1.7.7.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list