Move some code around.

2007-10-11  Behdad Esfahbod  <behdad@gnome.org>

        * pango/opentype/harfbuzz-buffer.c: Move some code around.
This commit is contained in:
Behdad Esfahbod 2007-10-11 07:21:31 +00:00 committed by Behdad Esfahbod
parent 7a5405c826
commit 7a26864308
1 changed files with 48 additions and 43 deletions

View File

@ -103,29 +103,64 @@ hb_buffer_duplicate_out_buffer( HB_Buffer buffer )
}
HB_Error
hb_buffer_new( HB_Buffer *buffer )
hb_buffer_new( HB_Buffer *pbuffer )
{
HB_Buffer buffer;
HB_Error error;
if ( ALLOC( *buffer, sizeof( HB_BufferRec ) ) )
if ( ALLOC( buffer, sizeof( HB_BufferRec ) ) )
return error;
(*buffer)->in_length = 0;
(*buffer)->out_length = 0;
(*buffer)->allocated = 0;
(*buffer)->in_pos = 0;
(*buffer)->out_pos = 0;
/* not these ones */
buffer->allocated = 0;
buffer->in_string = NULL;
buffer->alt_string = NULL;
buffer->positions = NULL;
(*buffer)->separate_out = FALSE;
(*buffer)->in_string = NULL;
(*buffer)->out_string = NULL;
(*buffer)->alt_string = NULL;
(*buffer)->positions = NULL;
(*buffer)->max_ligID = 0;
/* these should be reset when reusing buffer */
buffer->in_length = 0;
buffer->out_length = 0;
buffer->in_pos = 0;
buffer->out_pos = 0;
buffer->separate_out = FALSE;
buffer->out_string = buffer->in_string;
buffer->max_ligID = 0;
*pbuffer = buffer;
return HB_Err_Ok;
}
void
hb_buffer_free( HB_Buffer buffer )
{
FREE( buffer->in_string );
FREE( buffer->alt_string );
buffer->out_string = NULL;
FREE( buffer->positions );
FREE( buffer );
}
void
hb_buffer_clear( HB_Buffer buffer )
{
buffer->in_length = 0;
buffer->out_length = 0;
buffer->in_pos = 0;
buffer->out_pos = 0;
buffer->out_string = buffer->in_string;
buffer->separate_out = FALSE;
}
void
hb_buffer_clear_output( HB_Buffer buffer )
{
buffer->out_length = 0;
buffer->out_pos = 0;
buffer->out_string = buffer->in_string;
buffer->separate_out = FALSE;
}
HB_Error
hb_buffer_clear_positions( HB_Buffer buffer )
{
@ -142,15 +177,6 @@ hb_buffer_clear_positions( HB_Buffer buffer )
return HB_Err_Ok;
}
void
hb_buffer_clear_output( HB_Buffer buffer )
{
buffer->out_length = 0;
buffer->out_pos = 0;
buffer->out_string = buffer->in_string;
buffer->separate_out = FALSE;
}
void
hb_buffer_swap( HB_Buffer buffer )
{
@ -175,27 +201,6 @@ hb_buffer_swap( HB_Buffer buffer )
buffer->out_pos = tmp_pos;
}
void
hb_buffer_free( HB_Buffer buffer )
{
FREE( buffer->in_string );
FREE( buffer->alt_string );
buffer->out_string = NULL;
FREE( buffer->positions );
FREE( buffer );
}
void
hb_buffer_clear( HB_Buffer buffer )
{
buffer->in_length = 0;
buffer->out_length = 0;
buffer->in_pos = 0;
buffer->out_pos = 0;
buffer->out_string = buffer->in_string;
buffer->separate_out = FALSE;
}
HB_Error
hb_buffer_add_glyph( HB_Buffer buffer,
FT_UInt glyph_index,