提交 9417c1c0 编写于 作者: B Behdad Esfahbod

[API] Make hb_face_reference_table() return empty blob instead of NULL

The idea here is that:

  - Like pretty much all other API in harfbuzz, user does not have to
    check for NULL.

  - In any caller code, the case of missing table should be handled
    exactly the same way that a too-short table is handled.  Turning
    a non-existent talbe into a table of size 0 makes the user code
    safer.
上级 c035812f
...@@ -417,6 +417,8 @@ hb_face_reference_table (hb_face_t *face, ...@@ -417,6 +417,8 @@ hb_face_reference_table (hb_face_t *face,
return &_hb_blob_nil; return &_hb_blob_nil;
blob = face->get_table (tag, face->user_data); blob = face->get_table (tag, face->user_data);
if (unlikely (!blob))
blob = hb_blob_create_empty();
return blob; return blob;
} }
......
...@@ -286,9 +286,6 @@ struct Sanitizer ...@@ -286,9 +286,6 @@ struct Sanitizer
/* TODO is_sane() stuff */ /* TODO is_sane() stuff */
if (!blob)
return hb_blob_create_empty ();
retry: retry:
(void) (HB_DEBUG_SANITIZE && (void) (HB_DEBUG_SANITIZE &&
fprintf (stderr, "Sanitizer %p start %s\n", blob, HB_FUNC)); fprintf (stderr, "Sanitizer %p start %s\n", blob, HB_FUNC));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册