qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/4 V3] Utility function strpadcpy() added


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 1/4 V3] Utility function strpadcpy() added
Date: Mon, 09 Jul 2012 08:54:30 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

Il 07/07/2012 07:01, Deep Debroy ha scritto:
> Signed-off-by: Deep Debroy <address@hidden>
> ---
>  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 via email to

[Prev in Thread] Current Thread [Next in Thread]