Declare realloc by hand for Rust 1.99

rustc 1.99 adds the suspicious_runtime_symbol_definitions lint, which
fires on the bindgen-generated realloc binding because bindgen types
its size argument as c_ulong rather than usize. With -D warnings this
fails the format_rust check on the toolchain bump.

Declare realloc next to free in ffi_alloc.rs with the size_t-correct
signature and drop it from the bindgen allowlist. The only caller,
avc/core.rs, now imports it from there. No behaviour change.
This commit is contained in:
Carlos Fernandez
2026-10-01 20:48:24 -07:00
parent d62219016c
commit 12a47e069c
3 changed files with 6 additions and 2 deletions

View File

@@ -30,7 +30,6 @@ fn main() {
"store_hdcc",
"do_cb",
"decode_vbi",
"realloc",
"write_spumux_footer",
"write_spumux_header",
]);

View File

@@ -1,8 +1,9 @@
use crate::avc::common_types::*;
use crate::avc::nal::*;
use crate::avc::sei::*;
use crate::bindings::{cc_subtitle, encoder_ctx, lib_cc_decode, realloc};
use crate::bindings::{cc_subtitle, encoder_ctx, lib_cc_decode};
use crate::ctorust::FromCType;
use crate::ffi_alloc::realloc;
use crate::libccxr_exports::time::ccxr_set_fts;
use crate::{anchor_hdcc, current_fps, process_hdcc, store_hdcc, MPEG_CLOCK_FREQ};
use lib_ccxr::common::AvcNalType;

View File

@@ -2,6 +2,10 @@ use std::os::raw::c_void;
extern "C" {
fn free(ptr: *mut c_void);
// Declared here rather than through bindgen: bindgen types the size as
// `c_ulong`, which rustc >= 1.99 flags as a mismatched definition of a
// runtime symbol (`suspicious_runtime_symbol_definitions`).
pub fn realloc(ptr: *mut c_void, size: usize) -> *mut c_void;
}
/// Frees memory allocated by C code (malloc/calloc)
///