* [Qemu-devel] [PATCH 1/4 V3] Utility function strpadcpy() added
@ 2012-07-07 5:01 Deep Debroy
2012-07-09 6:54 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Deep Debroy @ 2012-07-07 5:01 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini
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);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH 1/4 V3] Utility function strpadcpy() added
2012-07-07 5:01 [Qemu-devel] [PATCH 1/4 V3] Utility function strpadcpy() added Deep Debroy
@ 2012-07-09 6:54 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2012-07-09 6:54 UTC (permalink / raw)
To: Deep Debroy; +Cc: qemu-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-09 6:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).