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

Avoid FT_MemoryRec #94

Open
bvssvni opened this issue Jan 1, 2015 · 1 comment
Open

Avoid FT_MemoryRec #94

bvssvni opened this issue Jan 1, 2015 · 1 comment

Comments

@bvssvni
Copy link
Member

bvssvni commented Jan 1, 2015

See #91 (comment)

Alternately, we could avoid dealing with FT_MemoryRec altogether and init FT_Library with FT_Init_Freetype. We don't have to worry about establishing our allocators because rustc links malloc to the proper platform implementation automatically.

@nox
Copy link
Member

nox commented Jul 3, 2016

I think we should keep it because Rust doesn't actually guarantee the various malloc linking shenanigans.

I think we should do some changes though:

  • Library::get_memory should go away (it doesn't actually return the memory routines used by that specific Library).
  • Library::new_memory should go away, one can just build a FT_MemoryRec by hand.
  • Library::init should become Library::new and use a hidden static MEMORY plugging into Rust's own memory routines.
  • A new unsafe function Library::new_with_memory should be introduced to tweak the default routines.

At the very least, the current Library::new_memory method is unsound, because this clearly should be an unsafe operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants