aboutsummaryrefslogtreecommitdiff
path: root/src/examples/mhd2spdy_structures.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/mhd2spdy_structures.c')
-rw-r--r--src/examples/mhd2spdy_structures.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/examples/mhd2spdy_structures.c b/src/examples/mhd2spdy_structures.c
index 2982b2a4..8e7852c2 100644
--- a/src/examples/mhd2spdy_structures.c
+++ b/src/examples/mhd2spdy_structures.c
@@ -138,3 +138,23 @@ void *au_malloc(size_t size)
138 } 138 }
139 return new_memory; 139 return new_memory;
140} 140}
141
142
143bool
144copy_buffer(const void *src, size_t src_size, void **dst, size_t *dst_size)
145{
146 if(0 == src_size)
147 return true;
148
149 if(NULL == *dst)
150 *dst = malloc(src_size);
151 else
152 *dst = realloc(*dst, src_size + *dst_size);
153 if(NULL == *dst)
154 return false;
155
156 memcpy(*dst + *dst_size, src, src_size);
157 *dst_size += src_size;
158
159 return true;
160}