[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 7/8] cutil: add strocat(), to concat a string to an of
From: |
Michael Roth |
Subject: |
[Qemu-devel] [RFC 7/8] cutil: add strocat(), to concat a string to an offset in another |
Date: |
Mon, 19 Sep 2011 09:41:48 -0500 |
Signed-off-by: Michael Roth <address@hidden>
---
cutils.c | 8 ++++++++
qemu-common.h | 1 +
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/cutils.c b/cutils.c
index c91f887..0835834 100644
--- a/cutils.c
+++ b/cutils.c
@@ -84,6 +84,14 @@ int stristart(const char *str, const char *val, const char
**ptr)
return 1;
}
+/* concat first 'offset' chars in 'dest' with 'src' */
+char *strocat(char *buf, const char *src, int offset)
+{
+ memcpy(&buf[offset], src, strlen(src));
+ buf[offset+strlen(src)] = '\0';
+ return buf;
+}
+
/* XXX: use host strnlen if available ? */
int qemu_strnlen(const char *s, int max_len)
{
diff --git a/qemu-common.h b/qemu-common.h
index 404c421..0a9b919 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -138,6 +138,7 @@ void pstrcpy(char *buf, int buf_size, const char *str);
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);
+char *strocat(char *dest, const char *src, int offset);
int qemu_strnlen(const char *s, int max_len);
time_t mktimegm(struct tm *tm);
int qemu_fls(int i);
--
1.7.0.4
- [Qemu-devel] [RFC] New Migration Protocol using Visitor Interface, Michael Roth, 2011/09/19
- [Qemu-devel] [RFC 1/8] qapi: add Visitor interfaces for uint*_t and int*_t, Michael Roth, 2011/09/19
- [Qemu-devel] [RFC 2/8] qapi: add QemuFileOutputVisitor, Michael Roth, 2011/09/19
- [Qemu-devel] [RFC 4/8] savevm: move QEMUFile interfaces into qemu-file.c, Michael Roth, 2011/09/19
- [Qemu-devel] [RFC 6/8] savevm: add QEMUFile->visitor lookup routines, Michael Roth, 2011/09/19
- [Qemu-devel] [RFC 5/8] qapi: test cases for QEMUFile input/output visitors, Michael Roth, 2011/09/19
- [Qemu-devel] [RFC 3/8] qapi: add QemuFileInputVisitor, Michael Roth, 2011/09/19
- [Qemu-devel] [RFC 7/8] cutil: add strocat(), to concat a string to an offset in another,
Michael Roth <=
- [Qemu-devel] [RFC 8/8] slirp: convert save/load function to visitor interface, Michael Roth, 2011/09/19