qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Milica Lazarevic <milica.lazarevic@syrmia.com>, thuth@redhat.com
Cc: qemu-devel@nongnu.org, cfontana@suse.de, berrange@redhat.com,
	pbonzini@redhat.com, vince.delvecchio@mediatek.com,
	peter.maydell@linaro.org, djordje.todorovic@syrmia.com,
	mips32r2@gmail.com, dragan.mladjenovic@syrmia.com
Subject: Re: [PATCH v3 15/24] disas/nanomips: Replace std::string type
Date: Tue, 13 Sep 2022 09:00:16 +0100	[thread overview]
Message-ID: <c3f92ec4-b642-a972-00d5-4d3b5afa2348@linaro.org> (raw)
In-Reply-To: <20220912122635.74032-16-milica.lazarevic@syrmia.com>

On 9/12/22 13:26, Milica Lazarevic wrote:
> 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>
> ---
>   disas/nanomips.cpp | 4776 ++++++++++++++++++++++----------------------
>   1 file changed, 2337 insertions(+), 2439 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


  reply	other threads:[~2022-09-13  8:04 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 12:26 [PATCH v3 0/24] Convert nanoMIPS disassembler from C++ to C Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 01/24] disas/nanomips: Remove namespace img Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 02/24] disas/nanomips: Extract enums out of the NMD class Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 03/24] disas/nanomips: Delete NMD class field Milica Lazarevic
2022-09-13  7:50   ` Richard Henderson
2022-09-12 12:26 ` [PATCH v3 04/24] disas/nanomips: Delete NMD class second field Milica Lazarevic
2022-09-13  7:51   ` Richard Henderson
2022-09-12 12:26 ` [PATCH v3 05/24] disas/nanomips: Remove helper methods from class Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 06/24] disas/nanomips: Remove __cond " Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 07/24] disas/nanomips: Remove disasm " Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 08/24] disas/nanomips: Remove Pool tables from the class Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 09/24] disas/nanomips: Remove NMD class Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 10/24] disas/nanomips: Move typedefs etc to nanomips.cpp Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 11/24] disas/nanomips: Delete nanomips.h Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 12/24] disas/nanomips: Remove #inlcude <sstream> Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 13/24] disas/nanomips: Delete copy functions Milica Lazarevic
2022-09-13  7:53   ` Richard Henderson
2022-09-12 12:26 ` [PATCH v3 14/24] disas/nanomips: Delete wrapper functions Milica Lazarevic
2022-09-13  7:54   ` Richard Henderson
2022-09-12 12:26 ` [PATCH v3 15/24] disas/nanomips: Replace std::string type Milica Lazarevic
2022-09-13  8:00   ` Richard Henderson [this message]
2022-09-12 12:26 ` [PATCH v3 16/24] disas/nanomips: Remove IMMEDIATE functions Milica Lazarevic
2022-09-13  8:03   ` Richard Henderson
2022-11-01  8:28   ` Stefan Weil via
2022-11-01  9:27     ` Philippe Mathieu-Daudé
2022-11-01 11:28       ` Stefan Weil via
2022-11-01 11:32         ` Philippe Mathieu-Daudé
2022-09-12 12:26 ` [PATCH v3 17/24] disas/nanomips: Remove CPR function Milica Lazarevic
2022-09-13  8:05   ` Richard Henderson
2022-09-12 12:26 ` [PATCH v3 18/24] disas/nanomips: Prevent memory leaking Milica Lazarevic
2022-09-13  8:06   ` Richard Henderson
2022-09-12 12:26 ` [PATCH v3 19/24] disas/nanomips: Remove function overloading Milica Lazarevic
2022-09-13  8:07   ` Richard Henderson
2022-09-12 12:26 ` [PATCH v3 20/24] disas/nanomips: Expand Dis_info struct Milica Lazarevic
2022-09-13  8:09   ` Richard Henderson
2022-09-12 12:26 ` [PATCH v3 21/24] disas/nanomips: Replace exception handling Milica Lazarevic
2022-09-13  8:12   ` Richard Henderson
2022-09-12 12:26 ` [PATCH v3 22/24] disas/nanomips: Replace Cpp enums for C enums Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 23/24] disas/nanomips: Remove argument passing by ref Milica Lazarevic
2022-09-12 12:26 ` [PATCH v3 24/24] disas/nanomips: Rename nanomips.cpp to nanomips.c Milica Lazarevic
2022-09-13  8:12   ` Richard Henderson
2022-10-27  7:25 ` [PATCH v3 0/24] Convert nanoMIPS disassembler from C++ to C Thomas Huth
2022-10-27 10:55   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c3f92ec4-b642-a972-00d5-4d3b5afa2348@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=berrange@redhat.com \
    --cc=cfontana@suse.de \
    --cc=djordje.todorovic@syrmia.com \
    --cc=dragan.mladjenovic@syrmia.com \
    --cc=milica.lazarevic@syrmia.com \
    --cc=mips32r2@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=vince.delvecchio@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).