public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Arthur Chunqi Li <yzt356@gmail.com>
Cc: kvm@vger.kernel.org, gleb@redhat.com, jan.kiszka@web.de
Subject: Re: [PATCH v4 1/3] kvm-unit-tests: Add memcpy to lib/string.c
Date: Fri, 21 Jun 2013 17:01:22 +0200	[thread overview]
Message-ID: <51C46AC2.8040900@redhat.com> (raw)
In-Reply-To: <1371738969-26658-1-git-send-email-yzt356@gmail.com>

Il 20/06/2013 16:36, Arthur Chunqi Li ha scritto:
> Add memcpy(void *dest, const void *src, size_t n) to lib/string.c.
> This function acts the same as memcpy in libc.
> 
> Signed-off-by: Arthur Chunqi Li <yzt356@gmail.com>
> ---
>  lib/libcflat.h |    1 +
>  lib/string.c   |   12 ++++++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/lib/libcflat.h b/lib/libcflat.h
> index 0875bd9..fadc33d 100644
> --- a/lib/libcflat.h
> +++ b/lib/libcflat.h
> @@ -50,6 +50,7 @@ extern int vsnprintf(char *buf, int size, const char *fmt, va_list va);
>  extern void puts(const char *s);
>  
>  extern void *memset(void *s, int c, size_t n);
> +extern void *memcpy(void *dest, const void *src, size_t n);
>  
>  extern long atol(const char *ptr);
>  #define ARRAY_SIZE(_a)  (sizeof(_a)/sizeof((_a)[0]))
> diff --git a/lib/string.c b/lib/string.c
> index 9dc94a1..e798f86 100644
> --- a/lib/string.c
> +++ b/lib/string.c
> @@ -42,6 +42,18 @@ void *memset(void *s, int c, size_t n)
>      return s;
>  }
>  
> +void *memcpy(void *dest, const void *src, size_t n)
> +{
> +    size_t i;
> +    char *a = dest;
> +    char *b = src;

I added a const here and pushed the three patches.

Paolo

> +
> +    for (i = 0; i < n; ++i)
> +        a[i] = b[i];
> +
> +    return dest;
> +}
> +
>  long atol(const char *ptr)
>  {
>      long acc = 0;
> 


      parent reply	other threads:[~2013-06-21 15:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20 14:36 [PATCH v4 1/3] kvm-unit-tests: Add memcpy to lib/string.c Arthur Chunqi Li
2013-06-20 14:36 ` [PATCH v4 2/3] kvm-unit-tests: Add a func to run instruction in emulator Arthur Chunqi Li
2013-06-20 14:36 ` [PATCH v4 3/3] kvm-unit-tests: Change two cases to use trap_emulator Arthur Chunqi Li
2013-06-21 15:01 ` 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=51C46AC2.8040900@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=yzt356@gmail.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