virsh-domain: Clean up cmdSendKey

Rename the get_integer_keycode helper to vshKeyCodeGetInt and get rid of
a unneeded typecast.
This commit is contained in:
Peter Krempa 2013-04-18 10:40:49 +02:00
parent 9b3322c766
commit 35d0f3b14a

View File

@ -6725,7 +6725,7 @@ static const vshCmdOptDef opts_send_key[] = {
}; };
static int static int
get_integer_keycode(const char *key_name) vshKeyCodeGetInt(const char *key_name)
{ {
unsigned int val; unsigned int val;
@ -6757,7 +6757,7 @@ cmdSendKey(vshControl *ctl, const vshCmd *cmd)
holdtime = 0; holdtime = 0;
codeset = virKeycodeSetTypeFromString(codeset_option); codeset = virKeycodeSetTypeFromString(codeset_option);
if ((int)codeset < 0) { if (codeset < 0) {
vshError(ctl, _("unknown codeset: '%s'"), codeset_option); vshError(ctl, _("unknown codeset: '%s'"), codeset_option);
goto cleanup; goto cleanup;
} }
@ -6768,7 +6768,7 @@ cmdSendKey(vshControl *ctl, const vshCmd *cmd)
goto cleanup; goto cleanup;
} }
if ((keycode = get_integer_keycode(opt->data)) <= 0) { if ((keycode = vshKeyCodeGetInt(opt->data)) <= 0) {
if ((keycode = virKeycodeValueFromString(codeset, opt->data)) <= 0) { if ((keycode = virKeycodeValueFromString(codeset, opt->data)) <= 0) {
vshError(ctl, _("invalid keycode: '%s'"), opt->data); vshError(ctl, _("invalid keycode: '%s'"), opt->data);
goto cleanup; goto cleanup;