get_table() is allowed to return NULL. Use that to simplify code

This commit is contained in:
Behdad Esfahbod 2010-05-20 16:23:27 +01:00
parent 99d9ef785f
commit 750a229455
2 changed files with 4 additions and 4 deletions

View File

@ -364,7 +364,7 @@ hb_face_get_table (hb_face_t *face,
blob = face->get_table (tag, face->user_data); blob = face->get_table (tag, face->user_data);
return blob? blob : &_hb_blob_nil; return likely (blob) ? blob : &_hb_blob_nil;
} }

View File

@ -153,11 +153,11 @@ _get_table (hb_tag_t tag, void *user_data)
FT_Error error; FT_Error error;
if (unlikely (tag == HB_TAG_NONE)) if (unlikely (tag == HB_TAG_NONE))
return hb_blob_create_empty (); return NULL;
error = FT_Load_Sfnt_Table (ft_face, tag, 0, NULL, &length); error = FT_Load_Sfnt_Table (ft_face, tag, 0, NULL, &length);
if (error) if (error)
return hb_blob_create_empty (); return NULL;
/* TODO Use FT_Memory? */ /* TODO Use FT_Memory? */
buffer = (FT_Byte *) malloc (length); buffer = (FT_Byte *) malloc (length);
@ -166,7 +166,7 @@ _get_table (hb_tag_t tag, void *user_data)
error = FT_Load_Sfnt_Table (ft_face, tag, 0, buffer, &length); error = FT_Load_Sfnt_Table (ft_face, tag, 0, buffer, &length);
if (error) if (error)
return hb_blob_create_empty (); return NULL;
return hb_blob_create ((const char *) buffer, length, return hb_blob_create ((const char *) buffer, length,
HB_MEMORY_MODE_WRITABLE, HB_MEMORY_MODE_WRITABLE,