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

Function assert_invariants

src/engine/jam_strings.cpp:16–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14# define JAM_STRING_MAGIC ((char)0xcf)
15# define JAM_STRING_MAGIC_SIZE 4
16static void assert_invariants( string * self )
17{
18 int i;
19
20 if ( self->value == 0 )
21 {
22 assert( self->size == 0 );
23 assert( self->capacity == 0 );
24 assert( self->opt[ 0 ] == 0 );
25 return;
26 }
27
28 assert( self->size < self->capacity );
29 assert( ( self->capacity <= int32_t(sizeof( self->opt )) ) == ( self->value == self->opt ) );
30 assert( self->value[ self->size ] == 0 );
31 /* String objects modified manually after construction to contain embedded
32 * '\0' characters are considered structurally valid.
33 */
34 assert( strlen( self->value ) <= size_t(self->size) );
35
36 for ( i = 0; i < 4; ++i )
37 {
38 assert( self->magic[ i ] == JAM_STRING_MAGIC );
39 assert( self->value[ self->capacity + i ] == JAM_STRING_MAGIC );
40 }
41}
42#else
43# define JAM_STRING_MAGIC_SIZE 0
44# define assert_invariants(x) do {} while (0)

Callers 8

string_newFunction · 0.85
string_freeFunction · 0.85
string_reserveFunction · 0.85
string_appendFunction · 0.85
string_append_rangeFunction · 0.85
string_truncateFunction · 0.85
string_backFunction · 0.85
string_rtrimFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected