Remove allocations_stubs

These were used to provide the `ts_record_*` functions regardless of
whether the `allocation-tracking` feature is enabled.  The allocation
tracking code is now implemented entirely in the `lib` crate, and only
when the feature is enabled, and so these stubs are no longer needed.
This commit is contained in:
Douglas Creager 2021-02-23 09:39:39 -05:00
parent a29c8d9264
commit a7e2b6a8b2
2 changed files with 0 additions and 43 deletions

View file

@ -1,40 +0,0 @@
// In all dev builds, the tree-sitter library is built with the `allocation-tracking`
// feature enabled. This causes the library to link against a set of externally
// defined C functions like `ts_record_malloc` and `ts_record_free`. In tests, these
// are defined to actually keep track of outstanding allocations. But when not running
// tests, the symbols still need to be defined. This file provides pass-through
// implementations of all of these functions.
use std::os::raw::c_void;
extern "C" {
fn malloc(size: usize) -> *mut c_void;
fn calloc(count: usize, size: usize) -> *mut c_void;
fn realloc(ptr: *mut c_void, size: usize) -> *mut c_void;
fn free(ptr: *mut c_void);
}
#[no_mangle]
unsafe extern "C" fn ts_record_malloc(size: usize) -> *const c_void {
malloc(size)
}
#[no_mangle]
unsafe extern "C" fn ts_record_calloc(count: usize, size: usize) -> *const c_void {
calloc(count, size)
}
#[no_mangle]
unsafe extern "C" fn ts_record_realloc(ptr: *mut c_void, size: usize) -> *const c_void {
realloc(ptr, size)
}
#[no_mangle]
unsafe extern "C" fn ts_record_free(ptr: *mut c_void) {
free(ptr)
}
#[no_mangle]
extern "C" fn ts_toggle_allocation_recording(_: bool) -> bool {
false
}

View file

@ -16,6 +16,3 @@ pub mod web_ui;
#[cfg(test)]
mod tests;
#[cfg(not(test))]
mod allocations_stubs;