| 68 | |
| 69 | |
| 70 | static void string_reserve_internal( string * self, size_t capacity ) |
| 71 | { |
| 72 | if ( self->value == self->opt ) |
| 73 | { |
| 74 | self->value = (char *)BJAM_MALLOC_ATOMIC( capacity + |
| 75 | JAM_STRING_MAGIC_SIZE ); |
| 76 | self->value[ 0 ] = 0; |
| 77 | strncat( self->value, self->opt, sizeof(self->opt) ); |
| 78 | assert( strlen( self->value ) <= self->capacity && "Regression test" ); |
| 79 | } |
| 80 | else |
| 81 | { |
| 82 | self->value = (char *)BJAM_REALLOC( self->value, capacity + |
| 83 | JAM_STRING_MAGIC_SIZE ); |
| 84 | } |
| 85 | #ifndef NDEBUG |
| 86 | memcpy( self->value + capacity, self->magic, JAM_STRING_MAGIC_SIZE ); |
| 87 | #endif |
| 88 | self->capacity = capacity; |
| 89 | } |
| 90 | |
| 91 | |
| 92 | void string_reserve( string * self, size_t capacity ) |
no outgoing calls
no test coverage detected