提交 b6a8c9df 编写于 作者: J Ján Tomko

virsh: getSignalNumber: rename variables

Use 'str' for the allocated copy of the string and 'p'
for the pointer into that string.
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
上级 76b4cd88
......@@ -8806,26 +8806,26 @@ static int getSignalNumber(vshControl *ctl, const char *signame)
{
size_t i;
int signum;
char *lower = vshStrdup(ctl, signame);
char *tmp = lower;
char *str = vshStrdup(ctl, signame);
char *p = str;
for (i = 0; signame[i]; i++)
lower[i] = c_tolower(signame[i]);
p[i] = c_tolower(signame[i]);
if (virStrToLong_i(lower, NULL, 10, &signum) >= 0)
if (virStrToLong_i(p, NULL, 10, &signum) >= 0)
goto cleanup;
if (STRPREFIX(lower, "sig_"))
lower += 4;
else if (STRPREFIX(lower, "sig"))
lower += 3;
if (STRPREFIX(p, "sig_"))
p += 4;
else if (STRPREFIX(p, "sig"))
p += 3;
if ((signum = virDomainProcessSignalTypeFromString(lower)) >= 0)
if ((signum = virDomainProcessSignalTypeFromString(p)) >= 0)
goto cleanup;
signum = -1;
cleanup:
VIR_FREE(tmp);
VIR_FREE(str);
return signum;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册