All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Michael Tokarev <mjt@tls.msk.ru>, qemu-trivial@nongnu.org
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] readline: use g_strndup instead of open-coding it
Date: Mon, 05 May 2014 11:39:19 +0200	[thread overview]
Message-ID: <53675C47.5020202@suse.de> (raw)
In-Reply-To: <1399281906-479-1-git-send-email-mjt@msgid.tls.msk.ru>

Am 05.05.2014 11:25, schrieb Michael Tokarev:
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  util/readline.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/util/readline.c b/util/readline.c
> index 8441be4..a3fd2cb 100644
> --- a/util/readline.c
> +++ b/util/readline.c
> @@ -279,9 +279,7 @@ static void readline_completion(ReadLineState *rs)
>  
>      rs->nb_completions = 0;
>  
> -    cmdline = g_malloc(rs->cmd_buf_index + 1);
> -    memcpy(cmdline, rs->cmd_buf, rs->cmd_buf_index);
> -    cmdline[rs->cmd_buf_index] = '\0';
> +    cmdline = g_strndup(rs->cmd_buf, rs->cmd_buf_index);
>      rs->completion_finder(rs->opaque, cmdline);
>      g_free(cmdline);
>  

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg


WARNING: multiple messages have this Message-ID (diff)
From: "Andreas Färber" <afaerber@suse.de>
To: Michael Tokarev <mjt@tls.msk.ru>, qemu-trivial@nongnu.org
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] readline: use g_strndup instead of open-coding it
Date: Mon, 05 May 2014 11:39:19 +0200	[thread overview]
Message-ID: <53675C47.5020202@suse.de> (raw)
In-Reply-To: <1399281906-479-1-git-send-email-mjt@msgid.tls.msk.ru>

Am 05.05.2014 11:25, schrieb Michael Tokarev:
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  util/readline.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/util/readline.c b/util/readline.c
> index 8441be4..a3fd2cb 100644
> --- a/util/readline.c
> +++ b/util/readline.c
> @@ -279,9 +279,7 @@ static void readline_completion(ReadLineState *rs)
>  
>      rs->nb_completions = 0;
>  
> -    cmdline = g_malloc(rs->cmd_buf_index + 1);
> -    memcpy(cmdline, rs->cmd_buf, rs->cmd_buf_index);
> -    cmdline[rs->cmd_buf_index] = '\0';
> +    cmdline = g_strndup(rs->cmd_buf, rs->cmd_buf_index);
>      rs->completion_finder(rs->opaque, cmdline);
>      g_free(cmdline);
>  

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2014-05-05  9:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-05  9:25 [Qemu-trivial] [PATCH] readline: use g_strndup instead of open-coding it Michael Tokarev
2014-05-05  9:25 ` [Qemu-devel] " Michael Tokarev
2014-05-05  9:39 ` Andreas Färber [this message]
2014-05-05  9:39   ` Andreas Färber

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=53675C47.5020202@suse.de \
    --to=afaerber@suse.de \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.