mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
7def8a4b93
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> |
||
---|---|---|
.. | ||
alpha.c | ||
capstone.c | ||
cris.c | ||
hexagon.c | ||
hppa.c | ||
m68k.c | ||
meson.build | ||
microblaze.c | ||
mips.c | ||
nanomips.cpp | ||
nios2.c | ||
riscv.c | ||
sh4.c | ||
sparc.c | ||
xtensa.c |