mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
nss: remove use for virString helper APIs
Use the plain libc APIs to avoid a dependancy on the main libvirt code from the nss module. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -41,7 +41,6 @@
|
|||||||
#include "virfile.h"
|
#include "virfile.h"
|
||||||
#include "virtime.h"
|
#include "virtime.h"
|
||||||
#include "virerror.h"
|
#include "virerror.h"
|
||||||
#include "virstring.h"
|
|
||||||
#include "virsocketaddr.h"
|
#include "virsocketaddr.h"
|
||||||
#include "configmake.h"
|
#include "configmake.h"
|
||||||
#include "virmacmap.h"
|
#include "virmacmap.h"
|
||||||
@@ -193,13 +192,20 @@ findLeaseInJSON(leaseAddress **tmpAddress,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (macs) {
|
if (macs) {
|
||||||
|
const char **macstmp = macs;
|
||||||
const char *macAddr;
|
const char *macAddr;
|
||||||
|
bool match = false;
|
||||||
|
|
||||||
macAddr = virJSONValueObjectGetString(lease, "mac-address");
|
macAddr = virJSONValueObjectGetString(lease, "mac-address");
|
||||||
if (!macAddr)
|
if (!macAddr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!virStringListHasString(macs, macAddr))
|
while (*macstmp && !match) {
|
||||||
|
if (STREQ(*macstmp, macAddr))
|
||||||
|
match = true;
|
||||||
|
macstmp++;
|
||||||
|
}
|
||||||
|
if (!match)
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
const char *lease_name;
|
const char *lease_name;
|
||||||
@@ -295,8 +301,9 @@ findLease(const char *name,
|
|||||||
DEBUG("Dir: %s", leaseDir);
|
DEBUG("Dir: %s", leaseDir);
|
||||||
while ((entry = readdir(dir)) != NULL) {
|
while ((entry = readdir(dir)) != NULL) {
|
||||||
char *path;
|
char *path;
|
||||||
|
size_t dlen = strlen(entry->d_name);
|
||||||
|
|
||||||
if (virStringHasSuffix(entry->d_name, ".status")) {
|
if (dlen >= 7 && STREQ(entry->d_name + dlen - 7, ".status")) {
|
||||||
if (!(path = virFileBuildPath(leaseDir, entry->d_name, NULL)))
|
if (!(path = virFileBuildPath(leaseDir, entry->d_name, NULL)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@@ -307,7 +314,7 @@ findLease(const char *name,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
VIR_FREE(path);
|
VIR_FREE(path);
|
||||||
} else if (virStringHasSuffix(entry->d_name, ".macs")) {
|
} else if (dlen >= 5 && STREQ(entry->d_name + dlen - 5, ".macs")) {
|
||||||
if (!(path = virFileBuildPath(leaseDir, entry->d_name, NULL)))
|
if (!(path = virFileBuildPath(leaseDir, entry->d_name, NULL)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user