* in_string and alt_string. alt_string is not allocated until its needed,
* but after that it's grown with in_string unconditionally.
*
- * The buffer->inplace boolean keeps status of whether out_string points to
- * in_string or alt_string.
+ * The buffer->separate_out boolean keeps status of whether out_string points
+ * to in_string (FALSE) or alt_string (TRUE).
*/
static HB_Error
if ( REALLOC_ARRAY( buffer->in_string, new_allocated, HB_GlyphItemRec ) )
return error;
- if ( buffer->inplace )
+ if ( buffer->separate_out )
+ {
+ if ( REALLOC_ARRAY( buffer->alt_string, new_allocated, HB_GlyphItemRec ) )
+ return error;
+
+ buffer->out_string = buffer->alt_string;
+ }
+ else
{
buffer->out_string = buffer->in_string;
return error;
}
}
- else
- {
- if ( REALLOC_ARRAY( buffer->alt_string, new_allocated, HB_GlyphItemRec ) )
- return error;
-
- buffer->out_string = buffer->alt_string;
- }
buffer->allocated = new_allocated;
}
buffer->out_string = buffer->alt_string;
memcpy( buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0]) );
- buffer->inplace = FALSE;
+ buffer->separate_out = TRUE;
return HB_Err_Ok;
}
(*buffer)->alt_string = NULL;
(*buffer)->positions = NULL;
(*buffer)->max_ligID = 0;
- (*buffer)->inplace = TRUE;
+ (*buffer)->separate_out = FALSE;
return HB_Err_Ok;
}
buffer->out_length = 0;
buffer->out_pos = 0;
buffer->out_string = buffer->in_string;
- buffer->inplace = TRUE;
+ buffer->separate_out = FALSE;
}
void
int tmp_length;
int tmp_pos;
- if ( ! buffer->inplace )
+ if ( buffer->separate_out )
{
tmp_string = buffer->in_string;
buffer->in_string = buffer->out_string;
buffer->in_pos = 0;
buffer->out_pos = 0;
buffer->out_string = buffer->in_string;
- buffer->inplace = TRUE;
+ buffer->separate_out = FALSE;
}
HB_Error
if ( error )
return error;
- if ( buffer->inplace )
+ if ( !buffer->separate_out )
{
error = hb_buffer_duplicate_out_buffer( buffer );
if ( error )
if ( error )
return error;
- if ( ! buffer->inplace )
+ if ( buffer->separate_out )
{
buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
}