mirror of https://gitee.com/openkylin/libvirt.git
Use g_strdup instead of ignoring VIR_STRDUP_QUIET's value
Replace all the occurrences of ignore_value(VIR_STRDUP_QUIET(a, b)); with a = g_strdup(b); Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
64023f6d21
commit
ea5bb994cb
|
@ -101,7 +101,7 @@ virLockManagerSanlockError(int err,
|
|||
{
|
||||
if (err <= -200) {
|
||||
#if HAVE_SANLOCK_STRERROR
|
||||
ignore_value(VIR_STRDUP_QUIET(*message, sanlock_strerror(err)));
|
||||
*message = g_strdup(sanlock_strerror(err));
|
||||
#else
|
||||
ignore_value(virAsprintfQuiet(message, _("sanlock error %d"), err));
|
||||
#endif
|
||||
|
|
|
@ -959,7 +959,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon G_GNUC_UNUSED,
|
|||
/* We have a SYNC API waiting for this event, dispatch it back */
|
||||
job->newstate = status;
|
||||
VIR_FREE(job->errmsg);
|
||||
ignore_value(VIR_STRDUP_QUIET(job->errmsg, error));
|
||||
job->errmsg = g_strdup(error);
|
||||
virDomainObjBroadcast(vm);
|
||||
} else {
|
||||
/* there is no waiting SYNC API, dispatch the update to a thread */
|
||||
|
@ -1749,11 +1749,11 @@ qemuProcessHandleDumpCompleted(qemuMonitorPtr mon G_GNUC_UNUSED,
|
|||
}
|
||||
priv->job.dumpCompleted = true;
|
||||
priv->job.current->stats.dump = *stats;
|
||||
ignore_value(VIR_STRDUP_QUIET(priv->job.error, error));
|
||||
priv->job.error = g_strdup(error);
|
||||
|
||||
/* Force error if extracting the DUMP_COMPLETED status failed */
|
||||
if (!error && status < 0) {
|
||||
ignore_value(VIR_STRDUP_QUIET(priv->job.error, virGetLastErrorMessage()));
|
||||
priv->job.error = g_strdup(virGetLastErrorMessage());
|
||||
priv->job.current->stats.dump.status = QEMU_MONITOR_DUMP_STATUS_FAILED;
|
||||
}
|
||||
|
||||
|
@ -3407,20 +3407,20 @@ qemuProcessUpdateState(virQEMUDriverPtr driver, virDomainObjPtr vm)
|
|||
oldReason == VIR_DOMAIN_PAUSED_STARTING_UP))) {
|
||||
newState = VIR_DOMAIN_RUNNING;
|
||||
newReason = VIR_DOMAIN_RUNNING_BOOTED;
|
||||
ignore_value(VIR_STRDUP_QUIET(msg, "finished booting"));
|
||||
msg = g_strdup("finished booting");
|
||||
} else if (state == VIR_DOMAIN_PAUSED && running) {
|
||||
newState = VIR_DOMAIN_RUNNING;
|
||||
newReason = VIR_DOMAIN_RUNNING_UNPAUSED;
|
||||
ignore_value(VIR_STRDUP_QUIET(msg, "was unpaused"));
|
||||
msg = g_strdup("was unpaused");
|
||||
} else if (state == VIR_DOMAIN_RUNNING && !running) {
|
||||
if (reason == VIR_DOMAIN_PAUSED_SHUTTING_DOWN) {
|
||||
newState = VIR_DOMAIN_SHUTDOWN;
|
||||
newReason = VIR_DOMAIN_SHUTDOWN_UNKNOWN;
|
||||
ignore_value(VIR_STRDUP_QUIET(msg, "shutdown"));
|
||||
msg = g_strdup("shutdown");
|
||||
} else if (reason == VIR_DOMAIN_PAUSED_CRASHED) {
|
||||
newState = VIR_DOMAIN_CRASHED;
|
||||
newReason = VIR_DOMAIN_CRASHED_PANICKED;
|
||||
ignore_value(VIR_STRDUP_QUIET(msg, "crashed"));
|
||||
msg = g_strdup("crashed");
|
||||
} else {
|
||||
newState = VIR_DOMAIN_PAUSED;
|
||||
newReason = reason;
|
||||
|
|
|
@ -187,8 +187,7 @@ virErrorGenericFailure(virErrorPtr err)
|
|||
err->code = VIR_ERR_INTERNAL_ERROR;
|
||||
err->domain = VIR_FROM_NONE;
|
||||
err->level = VIR_ERR_ERROR;
|
||||
ignore_value(VIR_STRDUP_QUIET(err->message,
|
||||
_("An error occurred, but the cause is unknown")));
|
||||
err->message = g_strdup(_("An error occurred, but the cause is unknown"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -831,7 +830,7 @@ virRaiseErrorFull(const char *filename,
|
|||
* formats the message; drop message on OOM situations
|
||||
*/
|
||||
if (fmt == NULL) {
|
||||
ignore_value(VIR_STRDUP_QUIET(str, _("No error message provided")));
|
||||
str = g_strdup(_("No error message provided"));
|
||||
} else {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -850,9 +849,9 @@ virRaiseErrorFull(const char *filename,
|
|||
to->code = code;
|
||||
to->message = str;
|
||||
to->level = level;
|
||||
ignore_value(VIR_STRDUP_QUIET(to->str1, str1));
|
||||
ignore_value(VIR_STRDUP_QUIET(to->str2, str2));
|
||||
ignore_value(VIR_STRDUP_QUIET(to->str3, str3));
|
||||
to->str1 = g_strdup(str1);
|
||||
to->str2 = g_strdup(str2);
|
||||
to->str3 = g_strdup(str3);
|
||||
to->int1 = int1;
|
||||
to->int2 = int2;
|
||||
|
||||
|
|
|
@ -1264,7 +1264,7 @@ virFileFindMountPoint(const char *type)
|
|||
|
||||
while (getmntent_r(f, &mb, mntbuf, sizeof(mntbuf))) {
|
||||
if (STREQ(mb.mnt_type, type)) {
|
||||
ignore_value(VIR_STRDUP_QUIET(ret, mb.mnt_dir));
|
||||
ret = g_strdup(mb.mnt_dir);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
@ -1667,7 +1667,7 @@ virFindFileInPath(const char *file)
|
|||
if (IS_ABSOLUTE_FILE_NAME(file)) {
|
||||
char *ret = NULL;
|
||||
if (virFileIsExecutable(file))
|
||||
ignore_value(VIR_STRDUP_QUIET(ret, file));
|
||||
ret = g_strdup(file);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1711,7 +1711,7 @@ virStorageFileChainLookup(virStorageSourcePtr chain,
|
|||
if (*parent && virStorageSourceIsLocalStorage(*parent))
|
||||
parentDir = mdir_name((*parent)->path);
|
||||
else
|
||||
ignore_value(VIR_STRDUP_QUIET(parentDir, "."));
|
||||
parentDir = g_strdup(".");
|
||||
|
||||
if (!parentDir) {
|
||||
virReportOOMError();
|
||||
|
|
|
@ -523,7 +523,7 @@ virGetHostnameImpl(bool quiet)
|
|||
* string as-is; it's up to callers to check whether "localhost"
|
||||
* is allowed.
|
||||
*/
|
||||
ignore_value(VIR_STRDUP_QUIET(result, hostname));
|
||||
result = g_strdup(hostname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ virGetHostnameImpl(bool quiet)
|
|||
if (!quiet)
|
||||
VIR_WARN("getaddrinfo failed for '%s': %s",
|
||||
hostname, gai_strerror(r));
|
||||
ignore_value(VIR_STRDUP_QUIET(result, hostname));
|
||||
result = g_strdup(hostname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -552,10 +552,10 @@ virGetHostnameImpl(bool quiet)
|
|||
* localhost. Ignore the canonicalized name and just return the
|
||||
* original hostname
|
||||
*/
|
||||
ignore_value(VIR_STRDUP_QUIET(result, hostname));
|
||||
result = g_strdup(hostname);
|
||||
else
|
||||
/* Caller frees this string. */
|
||||
ignore_value(VIR_STRDUP_QUIET(result, info->ai_canonname));
|
||||
result = g_strdup(info->ai_canonname);
|
||||
|
||||
freeaddrinfo(info);
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ testCommandDryRun(const char *const*args G_GNUC_UNUSED,
|
|||
void *opaque G_GNUC_UNUSED)
|
||||
{
|
||||
*status = 0;
|
||||
ignore_value(VIR_STRDUP_QUIET(*output, ""));
|
||||
ignore_value(VIR_STRDUP_QUIET(*error, ""));
|
||||
*output = g_strdup("");
|
||||
*error = g_strdup("");
|
||||
}
|
||||
|
||||
static int testCompareXMLToArgvFiles(const char *xml,
|
||||
|
|
|
@ -190,7 +190,7 @@ canonicalize_file_name(const char *path)
|
|||
if ((p = STRSKIP(path, "/some/symlink")))
|
||||
ignore_value(virAsprintfQuiet(&ret, "/gluster%s", p));
|
||||
else
|
||||
ignore_value(VIR_STRDUP_QUIET(ret, path));
|
||||
ret = g_strdup(path);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue