[API] Add hb_buffer_allocation_successful()

Returns the error status of the buffer.
This commit is contained in:
Behdad Esfahbod 2011-04-19 00:32:19 -04:00
parent 02a534b23f
commit aab0de50e2
3 changed files with 13 additions and 1 deletions

View File

@ -260,6 +260,12 @@ hb_buffer_pre_allocate (hb_buffer_t *buffer, unsigned int size)
return _hb_buffer_ensure (buffer, size); return _hb_buffer_ensure (buffer, size);
} }
hb_bool_t
hb_buffer_allocation_successful (hb_buffer_t *buffer)
{
return !buffer->in_error;
}
void void
hb_buffer_add_glyph (hb_buffer_t *buffer, hb_buffer_add_glyph (hb_buffer_t *buffer,
hb_codepoint_t codepoint, hb_codepoint_t codepoint,

View File

@ -106,10 +106,16 @@ hb_buffer_get_language (hb_buffer_t *buffer);
void void
hb_buffer_reset (hb_buffer_t *buffer); hb_buffer_reset (hb_buffer_t *buffer);
/* Returns FALSE if allocation failed */
hb_bool_t hb_bool_t
hb_buffer_pre_allocate (hb_buffer_t *buffer, hb_buffer_pre_allocate (hb_buffer_t *buffer,
unsigned int size); unsigned int size);
/* Returns FALSE if allocation has failed before */
hb_bool_t
hb_buffer_allocation_successful (hb_buffer_t *buffer);
void void
hb_buffer_reverse (hb_buffer_t *buffer); hb_buffer_reverse (hb_buffer_t *buffer);

View File

@ -185,7 +185,7 @@ main (int argc, char **argv)
/* XXX test invalid UTF-8 / UTF-16 text input (also overlong sequences) */ /* XXX test invalid UTF-8 / UTF-16 text input (also overlong sequences) */
/* XXX test reverse() and reverse_clusters() */ /* XXX test reverse() and reverse_clusters() */
/* XXX test ensure() and memory management */ /* XXX test pre_allocate(), allocation_successful(), and memory management */
/* XXX test buffer reset */ /* XXX test buffer reset */
/* XXX test buffer set length */ /* XXX test buffer set length */