]> Git Repo - qemu.git/commitdiff
cutils: add strpadcpy()
authorDmitry Fleytman <[email protected]>
Mon, 9 Jul 2012 06:50:43 +0000 (08:50 +0200)
committerPaolo Bonzini <[email protected]>
Thu, 26 Jul 2012 15:44:08 +0000 (17:44 +0200)
Signed-off-by: Yan Vugenfirer <[email protected]>
Signed-off-by: Dmitry Fleytman <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
cutils.c
qemu-common.h

index e2bc1b89df1ebab2e4cc0bd77e1d8a43f35be9f2..9d4c570939ba1a65131d0fd795347222bb27629f 100644 (file)
--- a/cutils.c
+++ b/cutils.c
 #include "qemu_socket.h"
 #include "iov.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;
index 7c8dac80a20d041608060df4f7230ec13f906c91..d26ff39e8768050b3b8aac60849624702dc7dc65 100644 (file)
@@ -138,6 +138,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);
This page took 0.033625 seconds and 4 git commands to generate.