# nm -D --defined-only --without-symbol-versions /lib64/libc.so.6 \
# | grep '_r$' \
# | awk '{print $3}' \
-# | grep -v -e '^_' -e 'qsort' -e 'readdir' \
+# | grep -v -e '^_' -e 'readdir' \
# | sort -u \
# | sed -s 's/_r$//'
#
-# qsort() is safe because we don't need to pass extra args to qsort comparator,
# readdir*() is safe as long as each DIR * instance is only used by one thread.
#
# Also manually add in all inet_* functions some of which
# Many of the function names below came from this filter:
# git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \
# |sed 's/.*\.c- *//'|perl -pe 's/ ?\(.*//'|sort -u \
-# |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'
+# |grep -vE '^(if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'
msg_gen_function =
msg_gen_function += VIR_ERROR
static int
virCapsHostCacheBankSorter(const void *a,
- const void *b)
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virCapsHostCacheBank *ca = *(virCapsHostCacheBank **)a;
virCapsHostCacheBank *cb = *(virCapsHostCacheBank **)b;
* still traverse the directory instead of guessing names (in case there is
* 'index1' and 'index3' but no 'index2'). */
if (caps->host.cache.banks) {
- qsort(caps->host.cache.banks, caps->host.cache.nbanks,
- sizeof(*caps->host.cache.banks), virCapsHostCacheBankSorter);
+ g_qsort_with_data(caps->host.cache.banks, caps->host.cache.nbanks,
+ sizeof(*caps->host.cache.banks),
+ virCapsHostCacheBankSorter, NULL);
}
if (virCapabilitiesInitResctrlMemory(caps) < 0)
}
-static int virDomainIdMapEntrySort(const void *a, const void *b)
+static int virDomainIdMapEntrySort(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
const virDomainIdMapEntry *entrya = a;
const virDomainIdMapEntry *entryb = b;
}
}
- qsort(idmap, num, sizeof(idmap[0]), virDomainIdMapEntrySort);
+ g_qsort_with_data(idmap, num, sizeof(idmap[0]), virDomainIdMapEntrySort, NULL);
return idmap;
}
static int
virCPUFeatureCompare(const void *p1,
- const void *p2)
+ const void *p2,
+ void *opaque G_GNUC_UNUSED)
{
const virCPUFeatureDef *f1 = p1;
const virCPUFeatureDef *f2 = p2;
driver->expandFeatures(cpu) < 0)
return -1;
- qsort(cpu->features, cpu->nfeatures, sizeof(*cpu->features),
- virCPUFeatureCompare);
+ g_qsort_with_data(cpu->features, cpu->nfeatures, sizeof(*cpu->features),
+ virCPUFeatureCompare, NULL);
VIR_DEBUG("nfeatures=%zu", cpu->nfeatures);
return 0;
static int
-virCPUx86DataSorter(const void *a, const void *b)
+virCPUx86DataSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virCPUx86DataItem *da = (virCPUx86DataItem *) a;
virCPUx86DataItem *db = (virCPUx86DataItem *) b;
virCPUx86DataItemCmp(const virCPUx86DataItem *item1,
const virCPUx86DataItem *item2)
{
- return virCPUx86DataSorter(item1, item2);
+ return virCPUx86DataSorter(item1, item2, NULL);
}
VIR_APPEND_ELEMENT_COPY(data->items, data->len,
*((virCPUx86DataItem *)item));
- qsort(data->items, data->len,
- sizeof(virCPUx86DataItem), virCPUx86DataSorter);
+ g_qsort_with_data(data->items, data->len,
+ sizeof(virCPUx86DataItem),
+ virCPUx86DataSorter, NULL);
}
return 0;
}
/* the rest of the code expects the function to be in order */
- qsort(cpuid->data.x86.items, cpuid->data.x86.len,
- sizeof(virCPUx86DataItem), virCPUx86DataSorter);
+ g_qsort_with_data(cpuid->data.x86.items, cpuid->data.x86.len,
+ sizeof(virCPUx86DataItem), virCPUx86DataSorter, NULL);
return cpuid;
}
if (!mounts)
return 0;
- qsort(mounts, nmounts, sizeof(mounts[0]), virStringSortRevCompare);
+ g_qsort_with_data(mounts, nmounts,
+ sizeof(mounts[0]), virStringSortRevCompare, NULL);
/* turn 'mounts' into a proper GStrv */
VIR_EXPAND_N(mounts, nmounts, 1);
static int
-virNWFilterRuleInstSortPtr(const void *a, const void *b)
+virNWFilterRuleInstSortPtr(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virNWFilterRuleInst * const *insta = a;
virNWFilterRuleInst * const *instb = b;
static int
ebiptablesFilterOrderSort(const void *va,
- const void *vb)
+ const void *vb,
+ void *opaque G_GNUC_UNUSED)
{
const virHashKeyValuePair *a = va;
const virHashKeyValuePair *b = vb;
static int
-ebtablesSubChainInstSort(const void *a, const void *b)
+ebtablesSubChainInstSort(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
const ebtablesSubChainInst **insta = (const ebtablesSubChainInst **)a;
const ebtablesSubChainInst **instb = (const ebtablesSubChainInst **)b;
if (filter_names == NULL)
return -1;
- qsort(filter_names, nfilter_names, sizeof(*filter_names), ebiptablesFilterOrderSort);
+ g_qsort_with_data(filter_names, nfilter_names,
+ sizeof(*filter_names), ebiptablesFilterOrderSort, NULL);
for (i = 0; filter_names[i].key; i++) {
g_autofree ebtablesSubChainInst *inst = NULL;
size_t nsubchains = 0;
int ret = -1;
- if (nrules)
- qsort(rules, nrules, sizeof(rules[0]),
- virNWFilterRuleInstSortPtr);
+ if (nrules) {
+ g_qsort_with_data(rules, nrules, sizeof(rules[0]),
+ virNWFilterRuleInstSortPtr, NULL);
+ }
/* cleanup whatever may exist */
virFirewallStartTransaction(fw, VIR_FIREWALL_TRANSACTION_IGNORE_ERRORS);
goto cleanup;
}
- if (nsubchains > 0)
- qsort(subchains, nsubchains, sizeof(subchains[0]),
- ebtablesSubChainInstSort);
+ if (nsubchains > 0) {
+ g_qsort_with_data(subchains, nsubchains,
+ sizeof(subchains[0]),
+ ebtablesSubChainInstSort, NULL);
+ }
for (i = 0, j = 0; i < nrules; i++) {
if (virNWFilterRuleIsProtocolEthernet(rules[i]->def)) {
static int
qemuMonitorQueryHotpluggableCpusEntrySort(const void *p1,
- const void *p2)
+ const void *p2,
+ void *opaque G_GNUC_UNUSED)
{
const struct qemuMonitorQueryHotpluggableCpusEntry *a = p1;
const struct qemuMonitorQueryHotpluggableCpusEntry *b = p2;
goto cleanup;
}
- qsort(info, ninfo, sizeof(*info), qemuMonitorQueryHotpluggableCpusEntrySort);
+ g_qsort_with_data(info, ninfo, sizeof(*info),
+ qemuMonitorQueryHotpluggableCpusEntrySort, NULL);
*entries = g_steal_pointer(&info);
*nentries = ninfo;
static int
qemuProcessVcpusSortOrder(const void *a,
- const void *b)
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virDomainVcpuDef *vcpua = *((virDomainVcpuDef **)a);
virDomainVcpuDef *vcpub = *((virDomainVcpuDef **)b);
if (nbootHotplug == 0)
return 0;
- qsort(bootHotplug, nbootHotplug, sizeof(*bootHotplug),
- qemuProcessVcpusSortOrder);
+ g_qsort_with_data(bootHotplug, nbootHotplug,
+ sizeof(*bootHotplug), qemuProcessVcpusSortOrder, NULL);
if (virDomainCgroupEmulatorAllNodesAllow(priv->cgroup, &emulatorCgroup) < 0)
goto cleanup;
static int
-cmpstringp(const void *p1, const void *p2)
+cmpstringp(const void *p1,
+ const void *p2,
+ void *opaque G_GNUC_UNUSED)
{
const char *s1 = *(char * const *) p1;
const char *s2 = *(char * const *) p2;
* paths in the same order and thus no deadlock can occur.
* Lastly, it makes searching for duplicate paths below
* simpler. */
- if (paths)
- qsort(paths, npaths, sizeof(*paths), cmpstringp);
+ if (paths) {
+ g_qsort_with_data(paths, npaths, sizeof(*paths), cmpstringp, NULL);
+ }
for (i = 0; i < npaths; i++) {
const char *p = paths[i];
mounts[nmounts - 2] = g_strdup(mntent.mnt_dir);
}
- if (mounts)
- qsort(mounts, nmounts - 1, sizeof(mounts[0]),
- reverse ? virStringSortRevCompare : virStringSortCompare);
+ if (mounts) {
+ g_qsort_with_data(mounts, nmounts - 1, sizeof(mounts[0]),
+ reverse ? virStringSortRevCompare : virStringSortCompare,
+ NULL);
+ }
*mountsret = mounts;
*nmountsret = nmounts ? nmounts - 1 : 0;
static int
virHashGetItemsKeySorter(const void *va,
- const void *vb)
+ const void *vb,
+ void *opaque G_GNUC_UNUSED)
{
const virHashKeyValuePair *a = va;
const virHashKeyValuePair *b = vb;
i++;
}
- if (sortKeys)
- qsort(items, *nitems, sizeof(*items), virHashGetItemsKeySorter);
+ if (sortKeys) {
+ g_qsort_with_data(items, *nitems,
+ sizeof(*items), virHashGetItemsKeySorter, NULL);
+ }
return items;
}
static int
virResctrlMonitorStatsSorter(const void *a,
- const void *b)
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
return (*(virResctrlMonitorStats **)a)->id
- (*(virResctrlMonitorStats **)b)->id;
}
/* Sort in id's ascending order */
- if (*nstats)
- qsort(*stats, *nstats, sizeof(**stats), virResctrlMonitorStatsSorter);
+ if (*nstats) {
+ g_qsort_with_data(*stats, *nstats, sizeof(**stats),
+ virResctrlMonitorStatsSorter, NULL);
+ }
ret = 0;
cleanup:
* virStringSortCompare:
*
* A comparator function for sorting strings in
- * normal order with qsort().
+ * normal order with g_qsort_with_data().
*/
-int virStringSortCompare(const void *a, const void *b)
+int virStringSortCompare(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
const char **sa = (const char**)a;
const char **sb = (const char**)b;
* virStringSortRevCompare:
*
* A comparator function for sorting strings in
- * reverse order with qsort().
+ * reverse order with g_qsort_with_data().
*/
-int virStringSortRevCompare(const void *a, const void *b)
+int virStringSortRevCompare(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
const char **sa = (const char**)a;
const char **sb = (const char**)b;
int virStrcpy(char *dest, const char *src, size_t destbytes);
#define virStrcpyStatic(dest, src) virStrcpy((dest), (src), sizeof(dest))
-int virStringSortCompare(const void *a, const void *b);
-int virStringSortRevCompare(const void *a, const void *b);
+int virStringSortCompare(const void *a,
+ const void *b,
+ void *opaque);
+int virStringSortRevCompare(const void *a,
+ const void *b,
+ void *opaque);
int virStringToUpper(char **dst, const char *src);
ssize_t virStringSearch(const char *str,
);
static int
-virTypedParamsSortName(const void *left, const void *right)
+virTypedParamsSortName(const void *left,
+ const void *right,
+ void *opaque G_GNUC_UNUSED)
{
const virTypedParameter *param_left = left, *param_right = right;
return strcmp(param_left->field, param_right->field);
/* Here we intentionally don't copy values */
memcpy(sorted, params, sizeof(*params) * nparams);
- qsort(sorted, nparams, sizeof(*sorted), virTypedParamsSortName);
+ g_qsort_with_data(sorted, nparams,
+ sizeof(*sorted), virTypedParamsSortName, NULL);
name = va_arg(ap, const char *);
while (name) {
va_end(ap);
- qsort(keys, nkeys, sizeof(*keys), virTypedParamsSortName);
+ g_qsort_with_data(keys, nkeys, sizeof(*keys), virTypedParamsSortName, NULL);
for (i = 0, j = 0; i < nparams && j < nkeys;) {
if (STRNEQ(sorted[i].field, keys[j].field)) {
}
}
-static int envsort(const void *a, const void *b)
+static int envsort(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
const char *astr = *(const char**)a;
const char *bstr = *(const char**)b;
newenv[i] = environ[i];
}
- qsort(newenv, length, sizeof(newenv[0]), envsort);
+ g_qsort_with_data(newenv, length, sizeof(newenv[0]), envsort, NULL);
for (i = 0; i < length; i++) {
/* Ignore the variables used to instruct the loader into
};
size_t i;
- qsort(randlist, G_N_ELEMENTS(randlist), sizeof(randlist[0]),
- virStringSortCompare);
- qsort(randrlist, G_N_ELEMENTS(randrlist), sizeof(randrlist[0]),
- virStringSortRevCompare);
+ g_qsort_with_data(randlist, G_N_ELEMENTS(randlist),
+ sizeof(randlist[0]), virStringSortCompare, NULL);
+ g_qsort_with_data(randrlist, G_N_ELEMENTS(randrlist),
+ sizeof(randrlist[0]), virStringSortRevCompare, NULL);
for (i = 0; i < G_N_ELEMENTS(randlist); i++) {
if (STRNEQ(randlist[i], sortlist[i])) {
static int
virshChkSorter(const void *a,
- const void *b)
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
const struct virshChk *sa = a;
const struct virshChk *sb = b;
}
if (!(orig_flags & VIR_DOMAIN_CHECKPOINT_LIST_TOPOLOGICAL) &&
- checkpointlist->chks)
- qsort(checkpointlist->chks, checkpointlist->nchks,
- sizeof(*checkpointlist->chks), virshChkSorter);
+ checkpointlist->chks) {
+ g_qsort_with_data(checkpointlist->chks, checkpointlist->nchks,
+ sizeof(*checkpointlist->chks), virshChkSorter, NULL);
+ }
ret = g_steal_pointer(&checkpointlist);
/* compare domains, pack NULLed ones at the end */
static int
-virshDomainSorter(const void *a, const void *b)
+virshDomainSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virDomainPtr *da = (virDomainPtr *) a;
virDomainPtr *db = (virDomainPtr *) b;
finished:
/* sort the list */
- if (list->domains && list->ndomains)
- qsort(list->domains, list->ndomains, sizeof(*list->domains),
- virshDomainSorter);
+ if (list->domains && list->ndomains) {
+ g_qsort_with_data(list->domains, list->ndomains,
+ sizeof(*list->domains), virshDomainSorter, NULL);
+ }
/* truncate the list if filter simulation deleted entries */
if (deleted)
};
static int
-vshPageSizeSorter(const void *a, const void *b)
+vshPageSizeSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
unsigned int pa = *(unsigned int *)a;
unsigned int pb = *(unsigned int *)b;
* @pagesize array will contain duplicates. We should
* remove them otherwise not very nice output will be
* produced. */
- qsort(pagesize, nodes_cnt, sizeof(*pagesize), vshPageSizeSorter);
+ g_qsort_with_data(pagesize, nodes_cnt,
+ sizeof(*pagesize), vshPageSizeSorter, NULL);
for (i = 0; i < nodes_cnt - 1;) {
if (pagesize[i] == pagesize[i + 1]) {
}
static int
-virshInterfaceSorter(const void *a, const void *b)
+virshInterfaceSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virInterfacePtr *ia = (virInterfacePtr *) a;
virInterfacePtr *ib = (virInterfacePtr *) b;
finished:
/* sort the list */
- if (list->ifaces && list->nifaces)
- qsort(list->ifaces, list->nifaces,
- sizeof(*list->ifaces), virshInterfaceSorter);
+ if (list->ifaces && list->nifaces) {
+ g_qsort_with_data(list->ifaces, list->nifaces,
+ sizeof(*list->ifaces), virshInterfaceSorter, NULL);
+ }
/* truncate the list if filter simulation deleted entries */
if (deleted)
}
static int
-virshNetworkSorter(const void *a, const void *b)
+virshNetworkSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virNetworkPtr *na = (virNetworkPtr *) a;
virNetworkPtr *nb = (virNetworkPtr *) b;
finished:
/* sort the list */
- if (list->nets && list->nnets)
- qsort(list->nets, list->nnets,
- sizeof(*list->nets), virshNetworkSorter);
+ if (list->nets && list->nnets) {
+ g_qsort_with_data(list->nets, list->nnets,
+ sizeof(*list->nets), virshNetworkSorter, NULL);
+ }
/* truncate the list if filter simulation deleted entries */
if (deleted)
};
static int
-virshNetworkDHCPLeaseSorter(const void *a, const void *b)
+virshNetworkDHCPLeaseSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virNetworkDHCPLeasePtr *lease1 = (virNetworkDHCPLeasePtr *) a;
virNetworkDHCPLeasePtr *lease2 = (virNetworkDHCPLeasePtr *) b;
}
/* Sort the list according to MAC Address/IAID */
- qsort(leases, nleases, sizeof(*leases), virshNetworkDHCPLeaseSorter);
+ g_qsort_with_data(leases, nleases,
+ sizeof(*leases), virshNetworkDHCPLeaseSorter, NULL);
table = vshTableNew(_("Expiry Time"), _("MAC address"), _("Protocol"),
_("IP address"), _("Hostname"), _("Client ID or DUID"),
static int
-virshNetworkPortSorter(const void *a, const void *b)
+virshNetworkPortSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virNetworkPortPtr *na = (virNetworkPortPtr *) a;
virNetworkPortPtr *nb = (virNetworkPortPtr *) b;
list->nports = ret;
/* sort the list */
- if (list->ports && list->nports)
- qsort(list->ports, list->nports,
- sizeof(*list->ports), virshNetworkPortSorter);
+ if (list->ports && list->nports) {
+ g_qsort_with_data(list->ports, list->nports,
+ sizeof(*list->ports), virshNetworkPortSorter, NULL);
+ }
success = true;
}
static int
-virshNodeDeviceSorter(const void *a, const void *b)
+virshNodeDeviceSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virNodeDevicePtr *na = (virNodeDevicePtr *) a;
virNodeDevicePtr *nb = (virNodeDevicePtr *) b;
finished:
/* sort the list */
- if (list->devices && list->ndevices)
- qsort(list->devices, list->ndevices,
- sizeof(*list->devices), virshNodeDeviceSorter);
+ if (list->devices && list->ndevices) {
+ g_qsort_with_data(list->devices, list->ndevices,
+ sizeof(*list->devices), virshNodeDeviceSorter, NULL);
+ }
/* truncate the list if filter simulation deleted entries */
if (deleted)
}
static int
-virshNWFilterSorter(const void *a, const void *b)
+virshNWFilterSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virNWFilterPtr *fa = (virNWFilterPtr *) a;
virNWFilterPtr *fb = (virNWFilterPtr *) b;
finished:
/* sort the list */
- if (list->filters && list->nfilters)
- qsort(list->filters, list->nfilters,
- sizeof(*list->filters), virshNWFilterSorter);
+ if (list->filters && list->nfilters) {
+ g_qsort_with_data(list->filters, list->nfilters,
+ sizeof(*list->filters), virshNWFilterSorter, NULL);
+ }
/* truncate the list for not found filter objects */
if (deleted)
static int
-virshNWFilterBindingSorter(const void *a, const void *b)
+virshNWFilterBindingSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virNWFilterBindingPtr *fa = (virNWFilterBindingPtr *) a;
virNWFilterBindingPtr *fb = (virNWFilterBindingPtr *) b;
list->nbindings = ret;
/* sort the list */
- if (list->bindings && list->nbindings > 1)
- qsort(list->bindings, list->nbindings,
- sizeof(*list->bindings), virshNWFilterBindingSorter);
+ if (list->bindings && list->nbindings > 1) {
+ g_qsort_with_data(list->bindings, list->nbindings,
+ sizeof(*list->bindings), virshNWFilterBindingSorter, NULL);
+ }
success = true;
}
static int
-virshStoragePoolSorter(const void *a, const void *b)
+virshStoragePoolSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virStoragePoolPtr *pa = (virStoragePoolPtr *) a;
virStoragePoolPtr *pb = (virStoragePoolPtr *) b;
finished:
/* sort the list */
- if (list->pools && list->npools)
- qsort(list->pools, list->npools,
- sizeof(*list->pools), virshStoragePoolSorter);
+ if (list->pools && list->npools) {
+ g_qsort_with_data(list->pools, list->npools,
+ sizeof(*list->pools), virshStoragePoolSorter, NULL);
+ }
/* truncate the list if filter simulation deleted entries */
if (deleted)
}
static int
-virshSecretSorter(const void *a, const void *b)
+virshSecretSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virSecretPtr *sa = (virSecretPtr *) a;
virSecretPtr *sb = (virSecretPtr *) b;
finished:
/* sort the list */
- if (list->secrets && list->nsecrets)
- qsort(list->secrets, list->nsecrets,
- sizeof(*list->secrets), virshSecretSorter);
+ if (list->secrets && list->nsecrets) {
+ g_qsort_with_data(list->secrets, list->nsecrets,
+ sizeof(*list->secrets), virshSecretSorter, NULL);
+ }
/* truncate the list for not found secret objects */
if (deleted)
}
static int
-virshSnapSorter(const void *a, const void *b)
+virshSnapSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
const struct virshSnap *sa = a;
const struct virshSnap *sb = b;
* still in list. We mark known descendants by clearing
* snaps[i].parents. Sorry, this is O(n^3) - hope your
* hierarchy isn't huge. XXX Is it worth making O(n^2 log n)
- * by using qsort and bsearch? */
+ * by using g_qsort_with_data and bsearch? */
if (start_index < 0) {
vshError(ctl, _("snapshot %1$s disappeared from list"), fromname);
goto cleanup;
}
if (!(orig_flags & VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL) &&
snaplist->snaps && snaplist->nsnaps) {
- qsort(snaplist->snaps, snaplist->nsnaps, sizeof(*snaplist->snaps),
- virshSnapSorter);
+ g_qsort_with_data(snaplist->snaps, snaplist->nsnaps,
+ sizeof(*snaplist->snaps), virshSnapSorter, NULL);
}
snaplist->nsnaps -= deleted;
}
static int
-virshStorageVolSorter(const void *a, const void *b)
+virshStorageVolSorter(const void *a,
+ const void *b,
+ void *opaque G_GNUC_UNUSED)
{
virStorageVolPtr *va = (virStorageVolPtr *) a;
virStorageVolPtr *vb = (virStorageVolPtr *) b;
finished:
/* sort the list */
- if (list->vols && list->nvols)
- qsort(list->vols, list->nvols, sizeof(*list->vols), virshStorageVolSorter);
+ if (list->vols && list->nvols) {
+ g_qsort_with_data(list->vols, list->nvols,
+ sizeof(*list->vols), virshStorageVolSorter, NULL);
+ }
if (deleted)
VIR_SHRINK_N(list->vols, list->nvols, deleted);