From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1So7rq-00062E-7Y for qemu-devel@nongnu.org; Mon, 09 Jul 2012 02:54:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1So7rn-0002Lf-0e for qemu-devel@nongnu.org; Mon, 09 Jul 2012 02:54:44 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:52017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1So7rm-0002LZ-Q3 for qemu-devel@nongnu.org; Mon, 09 Jul 2012 02:54:42 -0400 Received: by yhoo21 with SMTP id o21so11804436yho.4 for ; Sun, 08 Jul 2012 23:54:39 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4FFA8026.9050405@redhat.com> Date: Mon, 09 Jul 2012 08:54:30 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/4 V3] Utility function strpadcpy() added List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Deep Debroy Cc: qemu-devel@nongnu.org Il 07/07/2012 07:01, Deep Debroy ha scritto: > Signed-off-by: Deep Debroy > --- > 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