summaryrefslogtreecommitdiff
path: root/dis-asm.h
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-11-22 09:46:06 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-28 16:20:52 -0600
commiteba90e4efc80bc30c7d952ee6ea442207517a0da (patch)
tree427c6057aebd810361c0f2bbcc0339f47524b713 /dis-asm.h
parente36b369577784ac59a7d74725368eec66f23ad52 (diff)
downloadqemu-eba90e4efc80bc30c7d952ee6ea442207517a0da.tar.gz
qemu-eba90e4efc80bc30c7d952ee6ea442207517a0da.tar.bz2
qemu-eba90e4efc80bc30c7d952ee6ea442207517a0da.zip
cutils: Make strtosz & friends leave follow set to callers
strtosz() & friends require the size to be at the end of the string, or be followed by whitespace or ','. I find this surprising, because the name suggests it works like strtol(). The check simplifies callers that accept exactly that follow set slightly. No such callers exist. The check is redundant for callers that accept a smaller follow set, and thus need to check themselves anyway. Right now, this is the case for all but one caller. All of them neglected to check, or checked incorrectly, but the previous few commits fixed them up. Finally, the check is problematic for callers that accept a larger follow set. This is the case in monitor_parse_command(). Fortunately, the problems there are relatively harmless. monitor_parse_command() uses strtosz() for argument type 'o'. When the last argument is of type 'o', a trailing ',' is diagnosed differently than other trailing junk: (qemu) migrate_set_speed 1x invalid size (qemu) migrate_set_speed 1, migrate_set_speed: extraneous characters at the end of line A related inconsistency exists with non-last arguments. No such command exists, but let's use memsave to explore the inconsistency. The monitor permits, but does not require whitespace between arguments. For instance, "memsave (1-1)1024foo" is parsed as command memsave with three arguments 0, 1024 and "foo". Yes, this is daft, but at least it's consistently daft. If I change memsave's second argument from 'i' to 'o', then "memsave (1-1)1foo" is rejected, because the size is followed by an 'f'. But "memsave (1-1)1," is still accepted, and duly saves to file ",". We don't have any users of strtosz that profit from the check. In the users we have, it appears to encourage sloppy error checking, or gets in the way. Drop the bothersome check. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'dis-asm.h')
0 files changed, 0 insertions, 0 deletions