diff --git a/v2/engine/strings.c b/v2/engine/strings.c index 20d56e198..4198fe262 100644 --- a/v2/engine/strings.c +++ b/v2/engine/strings.c @@ -13,7 +13,7 @@ #ifndef NDEBUG # define JAM_STRING_MAGIC ((char)0xcf) # define JAM_STRING_MAGIC_SIZE 4 -static void assert_invariants( string* self ) +static void assert_invariants( string * self ) { int i; @@ -40,7 +40,7 @@ static void assert_invariants( string* self ) # define assert_invariants(x) do {} while (0) #endif -void string_new( string* s ) +void string_new( string * s ) { s->value = s->opt; s->size = 0; @@ -52,7 +52,7 @@ void string_new( string* s ) assert_invariants( s ); } -void string_free( string* s ) +void string_free( string * s ) { assert_invariants( s ); if ( s->value != s->opt ) @@ -60,7 +60,7 @@ void string_free( string* s ) string_new( s ); } -static void string_reserve_internal( string* self, size_t capacity ) +static void string_reserve_internal( string * self, size_t capacity ) { if ( self->value == self->opt ) { @@ -79,7 +79,7 @@ static void string_reserve_internal( string* self, size_t capacity ) self->capacity = capacity; } -void string_reserve( string* self, size_t capacity ) +void string_reserve( string * self, size_t capacity ) { assert_invariants( self ); if ( capacity <= self->capacity ) @@ -88,7 +88,7 @@ void string_reserve( string* self, size_t capacity ) assert_invariants( self ); } -static void extend_full( string* self, char const* start, char const* finish ) +static void extend_full( string * self, char const * start, char const * finish ) { size_t new_size = self->capacity + ( finish - start ); size_t new_capacity = self->capacity; @@ -101,10 +101,10 @@ static void extend_full( string* self, char const* start, char const* finish ) self->size = new_size; } -void string_append( string* self, char const* rhs ) +void string_append( string * self, char const * rhs ) { - char* p = self->value + self->size; - char* end = self->value + self->capacity; + char * p = self->value + self->size; + char * end = self->value + self->capacity; assert_invariants( self ); while ( *rhs && p != end ) @@ -122,10 +122,10 @@ void string_append( string* self, char const* rhs ) assert_invariants( self ); } -void string_append_range( string* self, char const* start, char const* finish ) +void string_append_range( string * self, char const * start, char const * finish ) { - char* p = self->value + self->size; - char* end = self->value + self->capacity; + char * p = self->value + self->size; + char * end = self->value + self->capacity; assert_invariants( self ); while ( p != end && start != finish ) @@ -143,13 +143,13 @@ void string_append_range( string* self, char const* start, char const* finish ) assert_invariants( self ); } -void string_copy( string* s, char const* rhs ) +void string_copy( string * s, char const * rhs ) { string_new( s ); string_append( s, rhs ); } -void string_truncate( string* self, size_t n ) +void string_truncate( string * self, size_t n ) { assert_invariants( self ); assert( n <= self->capacity ); @@ -157,17 +157,17 @@ void string_truncate( string* self, size_t n ) assert_invariants( self ); } -void string_pop_back( string* self ) +void string_pop_back( string * self ) { string_truncate( self, self->size - 1 ); } -void string_push_back( string* self, char x ) +void string_push_back( string * self, char x ) { string_append_range( self, &x, &x + 1 ); } -char string_back( string* self ) +char string_back( string * self ) { assert_invariants( self ); return self->value[self->size - 1]; @@ -183,10 +183,8 @@ void string_unit_test() string_new(s); - for (i = 0; i < limit; ++i) - { + for ( i = 0; i < limit; ++i ) string_push_back( s, (char)(i + 1) ); - }; for (i = 0; i < limit; ++i) {