static int virshNetworkSorter(const void *a, const void *b) { virNetworkPtr *na = (virNetworkPtr *) a; virNetworkPtr *nb = (virNetworkPtr *) b; if (*na && !*nb) return -1; if (!*na) return *nb != NULL; return vshStrcasecmp(virNetworkGetName(*na), virNetworkGetName(*nb)); }
static int vshNodeDeviceSorter(const void *a, const void *b) { virNodeDevicePtr *na = (virNodeDevicePtr *) a; virNodeDevicePtr *nb = (virNodeDevicePtr *) b; if (*na && !*nb) return -1; if (!*na) return *nb != NULL; return vshStrcasecmp(virNodeDeviceGetName(*na), virNodeDeviceGetName(*nb)); }
static int vshInterfaceSorter(const void *a, const void *b) { virInterfacePtr *ia = (virInterfacePtr *) a; virInterfacePtr *ib = (virInterfacePtr *) b; if (*ia && !*ib) return -1; if (!*ia) return *ib != NULL; return vshStrcasecmp(virInterfaceGetName(*ia), virInterfaceGetName(*ib)); }
static int vshStorageVolSorter(const void *a, const void *b) { virStorageVolPtr *va = (virStorageVolPtr *) a; virStorageVolPtr *vb = (virStorageVolPtr *) b; if (*va && !*vb) return -1; if (!*va) return *vb != NULL; return vshStrcasecmp(virStorageVolGetName(*va), virStorageVolGetName(*vb)); }
static int virshSecretSorter(const void *a, const void *b) { virSecretPtr *sa = (virSecretPtr *) a; virSecretPtr *sb = (virSecretPtr *) b; char uuid_sa[VIR_UUID_STRING_BUFLEN]; char uuid_sb[VIR_UUID_STRING_BUFLEN]; if (*sa && !*sb) return -1; if (!*sa) return *sb != NULL; virSecretGetUUIDString(*sa, uuid_sa); virSecretGetUUIDString(*sb, uuid_sb); return vshStrcasecmp(uuid_sa, uuid_sb); }