mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virsh: Add helper to avoid the strcase check for virsh-*.c
* 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
This commit is contained in:
2
cfg.mk
2
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
|
$(MAKE) -C src remote/remote_client_bodies.h
|
||||||
|
|
||||||
# List all syntax-check exemptions:
|
# 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
|
_src1=libvirt|fdstream|qemu/qemu_monitor|util/(command|util)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller
|
||||||
exclude_file_name_regexp--sc_avoid_write = \
|
exclude_file_name_regexp--sc_avoid_write = \
|
||||||
|
|||||||
@@ -1273,7 +1273,7 @@ vshDomainSorter(const void *a, const void *b)
|
|||||||
idb = virDomainGetID(*db);
|
idb = virDomainGetID(*db);
|
||||||
|
|
||||||
if (ida == inactive && idb == inactive)
|
if (ida == inactive && idb == inactive)
|
||||||
return strcasecmp(virDomainGetName(*da), virDomainGetName(*db));
|
return vshStrcasecmp(virDomainGetName(*da), virDomainGetName(*db));
|
||||||
|
|
||||||
if (ida != inactive && idb != inactive) {
|
if (ida != inactive && idb != inactive) {
|
||||||
if (ida > idb)
|
if (ida > idb)
|
||||||
|
|||||||
@@ -816,9 +816,8 @@ vshSnapSorter(const void *a, const void *b)
|
|||||||
if (!sa->snap)
|
if (!sa->snap)
|
||||||
return sb->snap != NULL;
|
return sb->snap != NULL;
|
||||||
|
|
||||||
/* User visible sort, so we want locale-specific case comparison. */
|
return vshStrcasecmp(virDomainSnapshotGetName(sa->snap),
|
||||||
return strcasecmp(virDomainSnapshotGetName(sa->snap),
|
virDomainSnapshotGetName(sb->snap));
|
||||||
virDomainSnapshotGetName(sb->snap));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute a list of snapshots from DOM. If FROM is provided, the
|
/* Compute a list of snapshots from DOM. If FROM is provided, the
|
||||||
|
|||||||
@@ -357,6 +357,9 @@ static void vshDebug(vshControl *ctl, int level, const char *format, ...)
|
|||||||
/* XXX: add batch support */
|
/* XXX: add batch support */
|
||||||
#define vshPrint(_ctl, ...) vshPrintExtra(NULL, __VA_ARGS__)
|
#define vshPrint(_ctl, ...) vshPrintExtra(NULL, __VA_ARGS__)
|
||||||
|
|
||||||
|
/* User visible sort, so we want locale-specific case comparison. */
|
||||||
|
#define vshStrcasecmp(S1, S2) strcasecmp(S1, S2)
|
||||||
|
|
||||||
static int vshDomainState(vshControl *ctl, virDomainPtr dom, int *reason);
|
static int vshDomainState(vshControl *ctl, virDomainPtr dom, int *reason);
|
||||||
static const char *vshDomainStateToString(int state);
|
static const char *vshDomainStateToString(int state);
|
||||||
static const char *vshDomainStateReasonToString(int state, int reason);
|
static const char *vshDomainStateReasonToString(int state, int reason);
|
||||||
@@ -462,8 +465,7 @@ vshNameSorter(const void *a, const void *b)
|
|||||||
const char **sa = (const char**)a;
|
const char **sa = (const char**)a;
|
||||||
const char **sb = (const char**)b;
|
const char **sb = (const char**)b;
|
||||||
|
|
||||||
/* User visible sort, so we want locale-specific case comparison. */
|
return vshStrcasecmp(*sa, *sb);
|
||||||
return strcasecmp(*sa, *sb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static double
|
static double
|
||||||
|
|||||||
Reference in New Issue
Block a user