129 sstr_t newstring; |
129 sstr_t newstring; |
130 newstring.ptr = ucx_mempool_malloc(mp, s.length + 1); |
130 newstring.ptr = ucx_mempool_malloc(mp, s.length + 1); |
131 newstring.length = s.length; |
131 newstring.length = s.length; |
132 newstring.ptr[newstring.length] = 0; |
132 newstring.ptr[newstring.length] = 0; |
133 |
133 |
134 memcpy(newstring.ptr, s.ptr, s.length); |
134 /* TODO: sometimes memcpy and/or memmove destroy the source */ |
|
135 //memcpy(newstring.ptr, s.ptr, s.length); |
|
136 for(int i=0;i<s.length;i++) { |
|
137 newstring.ptr[i] = s.ptr[i]; |
|
138 } |
135 |
139 |
136 return newstring; |
140 return newstring; |
137 } |
141 } |