Skip to content

Commit

Permalink
Merge pull request #353 from burrbull/cormc
Browse files Browse the repository at this point in the history
retry #188 (part 1 Enum Dispatch)
  • Loading branch information
burrbull authored Feb 7, 2021
2 parents efe98b1 + 50c7330 commit d0a40ce
Show file tree
Hide file tree
Showing 16 changed files with 1,491 additions and 932 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ derive_more = "0.99.7"
md5 = "0.7"
fontconfig_sys = { package = "yeslogic-fontconfig-sys", version = "2.11.1" }
once_cell = "1.5.2"
enum_dispatch = "0.3.5"

[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.9.1"
Expand Down
6 changes: 2 additions & 4 deletions engine/src/fmt_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,7 @@ pub(crate) unsafe fn store_fmt_file() {
Esc(&PoolString::from(yhash[FONT_ID_BASE + k - hash_offset].s1).to_string())
);

if matches!(&FONT_LAYOUT_ENGINE[k], crate::xetex_ext::Font::Native(_))
|| !(FONT_MAPPING[k]).is_null()
{
if matches!(&FONT_LAYOUT_ENGINE[k], Some(_)) || !(FONT_MAPPING[k]).is_null() {
t_print!(
"{:#}",
FileName {
Expand Down Expand Up @@ -854,7 +852,7 @@ pub(crate) unsafe fn load_fmt_file() -> bool {

FONT_MAPPING = vec![ptr::null_mut(); FONT_MAX + 1];
for _ in 0..FONT_MAX + 1 {
FONT_LAYOUT_ENGINE.push(crate::xetex_ext::Font::None);
FONT_LAYOUT_ENGINE.push(None);
}
FONT_FLAGS = vec![0; FONT_MAX + 1];
FONT_LETTER_SPACE = vec![Scaled::ZERO; FONT_MAX + 1];
Expand Down
15 changes: 1 addition & 14 deletions engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,6 @@ mod core_memory {
}
new_mem
}
#[no_mangle]
pub(crate) unsafe fn xrealloc(old_ptr: *mut libc::c_void, size: size_t) -> *mut libc::c_void {
let size = size as libc::size_t; //FIXME
let new_mem;
if old_ptr.is_null() {
new_mem = xmalloc(size as size_t)
} else {
new_mem = libc::realloc(old_ptr, if size != 0 { size } else { 1 });
if new_mem.is_null() {
panic!("xrealloc() to {} bytes failed", size,);
}
}
new_mem
}

#[inline]
pub(crate) unsafe fn mfree(ptr: *mut libc::c_void) -> *mut libc::c_void {
Expand All @@ -142,6 +128,7 @@ mod core_memory {

mod cmd;
mod node;
mod text_layout_engine;
mod xetex_aatfont;
mod xetex_consts;
mod xetex_engine_interface;
Expand Down
Loading

0 comments on commit d0a40ce

Please sign in to comment.