[subset] Rename constructor to hb_subset_input_create_or_fail()
To signify that unlike rest of library, returns nullptr on failure.
This commit is contained in:
parent
507804479a
commit
9046e92442
|
@ -29,19 +29,17 @@
|
|||
#include "hb-set-private.hh"
|
||||
|
||||
/**
|
||||
* hb_subset_input_create:
|
||||
* hb_subset_input_create_or_fail:
|
||||
*
|
||||
* Return value: New subset input.
|
||||
*
|
||||
* Since: 1.8.0
|
||||
**/
|
||||
hb_subset_input_t *
|
||||
hb_subset_input_create (void)
|
||||
hb_subset_input_create_or_fail (void)
|
||||
{
|
||||
hb_subset_input_t *input = hb_object_create<hb_subset_input_t>();
|
||||
|
||||
/* Unlike libharfbuzz, in this lib we return nullptr
|
||||
* in case of allocation failure. */
|
||||
if (unlikely (!input))
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ hb_subset_profile_destroy (hb_subset_profile_t *profile);
|
|||
typedef struct hb_subset_input_t hb_subset_input_t;
|
||||
|
||||
HB_EXTERN hb_subset_input_t *
|
||||
hb_subset_input_create (void);
|
||||
hb_subset_input_create_or_fail (void);
|
||||
|
||||
HB_EXTERN hb_subset_input_t *
|
||||
hb_subset_input_reference (hb_subset_input_t *subset_input);
|
||||
|
|
|
@ -95,9 +95,10 @@ test_subset_glyf (void)
|
|||
hb_blob_t *glyf_expected_blob;
|
||||
hb_blob_t *glyf_actual_blob;
|
||||
hb_subset_profile_t *profile = hb_subset_profile_create();
|
||||
hb_subset_input_t *input = hb_subset_input_create ();
|
||||
hb_subset_input_t *input = hb_subset_input_create_or_fail ();
|
||||
hb_set_t *codepoints = hb_set_reference (hb_subset_input_unicode_set (input));
|
||||
|
||||
g_assert (input);
|
||||
g_assert (face_abc);
|
||||
g_assert (face_ac);
|
||||
|
||||
|
|
|
@ -43,12 +43,15 @@ test_subset (void)
|
|||
hb_face_t *face = hb_face_create(font_blob, 0);
|
||||
|
||||
hb_subset_profile_t *profile = hb_subset_profile_create();
|
||||
hb_subset_input_t *input = hb_subset_input_create ();
|
||||
hb_subset_input_t *input = hb_subset_input_create_or_fail ();
|
||||
|
||||
hb_face_t *out_face = hb_subset(face, profile, input);
|
||||
hb_blob_t *output;
|
||||
|
||||
g_assert (input);
|
||||
g_assert(out_face);
|
||||
g_assert(out_face != hb_face_get_empty ());
|
||||
hb_blob_t *output = hb_face_reference_blob (out_face);
|
||||
output = hb_face_reference_blob (out_face);
|
||||
|
||||
unsigned int output_length;
|
||||
const char *output_data = hb_blob_get_data(output, &output_length);
|
||||
|
|
|
@ -43,7 +43,7 @@ struct subset_consumer_t
|
|||
const font_options_t *font_opts)
|
||||
{
|
||||
font = hb_font_reference (font_opts->get_font ());
|
||||
input = hb_subset_input_create ();
|
||||
input = hb_subset_input_create_or_fail ();
|
||||
}
|
||||
|
||||
void consume_line (const char *text,
|
||||
|
|
Loading…
Reference in New Issue