Changeset 815 for trunk/superstring/source/allocator.c
- Timestamp:
- 03/28/08 22:32:22 (4 years ago)
- File:
-
- 1 edited
-
trunk/superstring/source/allocator.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/superstring/source/allocator.c
r812 r815 49 49 50 50 /* This function will grow the data pointed to by an ss_internal structure 51 * as need-be. It will also correctly handle structure type transitioning. */ 52 int ss_grow(ss_internal *istr) { 51 * as need-be. It will also correctly handle structure type transitioning 52 * and assign the correct memory address to 'outstr' (if provided) */ 53 int ss_grow(ss_internal *istr, superstring *outstr) { 53 54 size_t grow; 54 55 size_t memsize; … … 115 116 } 116 117 117 /* map in the updated values */ 118 /* map in the updated values. Mostly we can do this by calling 119 * ssi_to_ss, but we also need to update the data pointer of istr to 120 * reflect the new address of the data. */ 118 121 ssi_to_ss(istr, istr->str); 122 istr->data = ss_cstring(str); 123 if (outstr != NULL) 124 *outstr = istr->str; 125 119 126 ss_returnerror(SS_ERROR_SUCCESS); 120 127 } … … 151 158 istr.size = size; 152 159 153 if (ss_grow(&istr ) != SS_ERROR_SUCCESS)160 if (ss_grow(&istr, NULL) != SS_ERROR_SUCCESS) 154 161 return NULL; 155 162 156 163 /* Copy our data in */ 157 cstr = ss_cstring(istr.str);164 cstr = (unsigned char *)ss_cstring(istr.str); 158 165 memcpy((void *)cstr, value, istr.len); 159 166 cstr[istr.len] = '\0';
Note: See TracChangeset
for help on using the changeset viewer.
