Ignore:
Timestamp:
03/28/08 22:32:22 (4 years ago)
Author:
wd
Message:

Interrim update for superstring bits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/superstring/source/allocator.c

    r812 r815  
    4949 
    5050/* 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) */ 
     53int ss_grow(ss_internal *istr, superstring *outstr) { 
    5354    size_t grow; 
    5455    size_t memsize; 
     
    115116    } 
    116117 
    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. */ 
    118121    ssi_to_ss(istr, istr->str); 
     122    istr->data = ss_cstring(str); 
     123    if (outstr != NULL) 
     124        *outstr = istr->str; 
     125 
    119126    ss_returnerror(SS_ERROR_SUCCESS); 
    120127} 
     
    151158    istr.size = size; 
    152159 
    153     if (ss_grow(&istr) != SS_ERROR_SUCCESS) 
     160    if (ss_grow(&istr, NULL) != SS_ERROR_SUCCESS) 
    154161        return NULL; 
    155162 
    156163    /* Copy our data in */ 
    157     cstr = ss_cstring(istr.str); 
     164    cstr = (unsigned char *)ss_cstring(istr.str); 
    158165    memcpy((void *)cstr, value, istr.len); 
    159166    cstr[istr.len] = '\0'; 
Note: See TracChangeset for help on using the changeset viewer.