Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[blob] Add failing versions of create API #3026

Closed
wants to merge 1 commit into from
Closed

Conversation

behdad
Copy link
Member

@behdad behdad commented Jun 14, 2021

Fixes #2567

New API:
+hb_blob_create_or_fail()
+hb_blob_create_from_file_or_fail()

Use these in util/ to distinguish empty file from not-found file.
Only err on the latter.

Fixes #2567

New API:
+hb_blob_create_or_fail()
+hb_blob_create_from_file_or_fail()

Use these in util/ to distinguish empty file from not-found file.
Only err on the latter.
@behdad
Copy link
Member Author

behdad commented Jun 14, 2021

This, specifically, doesn't change any semantics of the existing API. In particular, hb_blob_create() with length=0 still just returns the empty blob; we depend on this for non-existing font tables to not allocate a blob wastefully. The new hb_blob_create_or_fail() however doesn't do that and gives flexibility back to the caller to decide.

Copy link
Collaborator

@khaledhosny khaledhosny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to have been merged into master (by accident?).

@@ -71,15 +71,49 @@ hb_blob_create (const char *data,
hb_memory_mode_t mode,
void *user_data,
hb_destroy_func_t destroy)
{
if (!length)
return hb_blob_get_empty ();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to call destroy() here like in the (old) code below?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Riiiiight.

@behdad
Copy link
Member Author

behdad commented Jun 19, 2021

This seems to have been merged into master (by accident?).

Ouch.

@khaledhosny
Copy link
Collaborator

Since this is merged already, should we close this PR?

@behdad behdad closed this Jun 24, 2021
@khaledhosny khaledhosny deleted the blob-or-fail branch July 12, 2021 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hb_blob_create_from_file return the same thing when a file is not found or empty
2 participants