aboutsummaryrefslogtreecommitdiff
path: root/include/hw/misc
diff options
context:
space:
mode:
authorMilica Lazarevic <milica.lazarevic@syrmia.com>2022-09-12 14:26:26 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2022-10-31 11:32:07 +0100
commit7def8a4b937262c2710d2cd5fdb21e7af4b0529a (patch)
treec6d335602e6b9a791ec345c0d9e3240d54d930c8 /include/hw/misc
parentafc47e07e57e9f39a9dfdf240d67b65a284b15d8 (diff)
downloadqemu-7def8a4b937262c2710d2cd5fdb21e7af4b0529a.zip
qemu-7def8a4b937262c2710d2cd5fdb21e7af4b0529a.tar.gz
qemu-7def8a4b937262c2710d2cd5fdb21e7af4b0529a.tar.bz2
disas/nanomips: Replace std::string type
The return type of typedef disassembly_function is changed to char * instead of std::string. Therefore, for every particular disassembly_function function signature is changed. For example: - static std::string ABS_D(uint64 instruction, img_address m_pc) {...} is replaced with - static char *ABS_D(uint64 instruction, img_address m_pc) {...} Every helper function used to return std::string is changed to return const char * or char *. Where the return value points to a static string that the caller must not free, the return type is const char *. If a function allocates memory and the caller is required to free it, the return type is a char *. This applies to the following functions: img_format, to_string, GPR, save_restore_list, FPR, etc. Now that we replaced every std::string for const char * or char *, it is possible to delete multiple versions of the img_format function. The general version: - static char *img_format(const char *format, ...) {...} can handle all string formatting, so others have been deleted. Where necessary, strings are dynamically allocated with g_strjoinv, g_strdup, g_strdup_vprintf, and g_strdup_printf. Memory leaking will be prevented later. String concatenation in the save_restore_list() function is handled using g_strjoinv() function instead of += operator. The type of the "dis" parameter in the Disassemble function is changed - from std::string & - to char ** Without applying all of these changes, the nanomips disassembler may be buildable but can't produce the appropriate output, so all of them are made together. Signed-off-by: Milica Lazarevic <milica.lazarevic@syrmia.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220912122635.74032-16-milica.lazarevic@syrmia.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'include/hw/misc')
0 files changed, 0 insertions, 0 deletions