qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Deep Debroy <ddebroy@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/4 V3] Utility function strpadcpy() added
Date: Mon, 09 Jul 2012 08:54:30 +0200	[thread overview]
Message-ID: <4FFA8026.9050405@redhat.com> (raw)
In-Reply-To: <CABg=H3MaiZHsz_e_v0oNnqKhoABc3rw665LAS1gpCo5m+9FTnA@mail.gmail.com>

Il 07/07/2012 07:01, Deep Debroy ha scritto:
> Signed-off-by: Deep Debroy <ddebroy@gmail.com>
> ---
>  cutils.c      |    7 +++++++
>  qemu-common.h |    1 +
>  2 files changed, 8 insertions(+)
> 
> diff --git a/cutils.c b/cutils.c
> index af308cd..68a7d10 100644
> --- a/cutils.c
> +++ b/cutils.c
> @@ -27,6 +27,13 @@
> 
>  #include "qemu_socket.h"
> 
> +void strpadcpy(char *buf, int buf_size, const char *str, char pad)
> +{
> +    int len = qemu_strnlen(str, buf_size);
> +    memcpy(buf, str, len);
> +    memset(buf + len, pad, buf_size - len);
> +}
> +
>  void pstrcpy(char *buf, int buf_size, const char *str)
>  {
>      int c;
> diff --git a/qemu-common.h b/qemu-common.h
> index 9d9e603..1d8a514 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -137,6 +137,7 @@ int qemu_timedate_diff(struct tm *tm);
> 
>  /* cutils.c */
>  void pstrcpy(char *buf, int buf_size, const char *str);
> +void strpadcpy(char *buf, int buf_size, const char *str, char pad);
>  char *pstrcat(char *buf, int buf_size, const char *s);
>  int strstart(const char *str, const char *val, const char **ptr);
>  int stristart(const char *str, const char *val, const char **ptr);
> 

Applied to scsi-next branch with correct attribution to Dmitry Fleitman
(based on
http://lists.gnu.org/archive/html/qemu-devel/2012-03/msg03441.html).

Paolo

      reply	other threads:[~2012-07-09  6:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-07  5:01 [Qemu-devel] [PATCH 1/4 V3] Utility function strpadcpy() added Deep Debroy
2012-07-09  6:54 ` Paolo Bonzini [this message]

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=4FFA8026.9050405@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=ddebroy@gmail.com \
    --cc=qemu-devel@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 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).