mirror of https://gitee.com/openkylin/libvirt.git
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:
parent
1f7a291c96
commit
be023c0896
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
|
||||
|
||||
# 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 = \
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -816,9 +816,8 @@ vshSnapSorter(const void *a, const void *b)
|
|||
if (!sa->snap)
|
||||
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
|
||||
|
|
|
@ -357,6 +357,9 @@ static void vshDebug(vshControl *ctl, int level, const char *format, ...)
|
|||
/* XXX: add batch support */
|
||||
#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 const char *vshDomainStateToString(int state);
|
||||
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 **sb = (const char**)b;
|
||||
|
||||
/* User visible sort, so we want locale-specific case comparison. */
|
||||
return strcasecmp(*sa, *sb);
|
||||
return vshStrcasecmp(*sa, *sb);
|
||||
}
|
||||
|
||||
static double
|
||||
|
|
Loading…
Reference in New Issue