[API] Add hb_buffer_allocation_successful()
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 19 Apr 2011 04:32:19 +0000 (00:32 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Tue, 19 Apr 2011 04:32:19 +0000 (00:32 -0400)
Returns the error status of the buffer.

src/hb-buffer.cc
src/hb-buffer.h
test/test-buffer.c

index 11639ef..68ef594 100644 (file)
@@ -260,6 +260,12 @@ hb_buffer_pre_allocate (hb_buffer_t *buffer, unsigned int size)
   return _hb_buffer_ensure (buffer, size);
 }
 
+hb_bool_t
+hb_buffer_allocation_successful (hb_buffer_t  *buffer)
+{
+  return !buffer->in_error;
+}
+
 void
 hb_buffer_add_glyph (hb_buffer_t    *buffer,
                     hb_codepoint_t  codepoint,
index 0c3ef3a..c22e31d 100644 (file)
@@ -106,10 +106,16 @@ hb_buffer_get_language (hb_buffer_t *buffer);
 void
 hb_buffer_reset (hb_buffer_t *buffer);
 
+/* Returns FALSE if allocation failed */
 hb_bool_t
 hb_buffer_pre_allocate (hb_buffer_t  *buffer,
                        unsigned int  size);
 
+
+/* Returns FALSE if allocation has failed before */
+hb_bool_t
+hb_buffer_allocation_successful (hb_buffer_t  *buffer);
+
 void
 hb_buffer_reverse (hb_buffer_t *buffer);
 
index c2b199b..9522515 100644 (file)
@@ -185,7 +185,7 @@ main (int argc, char **argv)
 
   /* XXX test invalid UTF-8 / UTF-16 text input (also overlong sequences) */
   /* 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 set length */