MCPcopy Create free account
hub / github.com/boostorg/build / string_reserve_internal

Function string_reserve_internal

v2/engine/strings.c:70–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68
69
70static 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
92void string_reserve( string * self, size_t capacity )

Callers 3

string_reserveFunction · 0.85
extend_fullFunction · 0.85
maybe_reserveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected