Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions src/bun_core/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3838,8 +3838,7 @@ pub(crate) fn set_bun_options_argc(n: usize) {
}

/// Trait for arg types accepted by [`append_options_env`].
/// Impl'd for `bun_core::String`
/// and `Box<ZStr>` in their owning crates.
/// Impl'd for `&'static ZStr` and `bun_core::String`.
pub trait OptionsEnvArg {
fn from_slice(s: &[u8]) -> Self;
fn from_buf(buf: Vec<u8>) -> Self;
Expand All @@ -3863,22 +3862,6 @@ impl OptionsEnvArg for &'static ZStr {
}
}

/// Owned `Box<ZStr>` arm of `appendOptionsEnv` — used by `bun::init_argv`'s
/// BUN_OPTIONS splice path, which stores argv entries as `Box<ZStr>`.
impl OptionsEnvArg for Box<ZStr> {
fn from_slice(s: &[u8]) -> Self {
ZStr::boxed(s)
}
fn from_buf(mut buf: Vec<u8>) -> Self {
buf.push(0);
let b: Box<[u8]> = buf.into_boxed_slice();
// SAFETY: `ZStr` is `#[repr(transparent)]` over `[u8]`; the fat-pointer
// metadata (len includes the trailing NUL) is preserved by the cast —
// identical to `ZStr::boxed` but consuming the Vec without re-copying.
unsafe { crate::heap::take(crate::heap::into_raw(b) as *mut ZStr) }
}
}

/// Parse a `BUN_OPTIONS`-style string
/// (`--flag=value --flag2 "quoted value" bare`) and insert each token into
/// `args` starting at index 1 (callers prepend a placeholder at [0]).
Expand Down
15 changes: 1 addition & 14 deletions src/io/io_darwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,4 @@ extern "C" bool io_darwin_schedule_wakeup(mach_port_t waker)
}
}

#else

// stub out these symbols
extern "C" int io_darwin_create_machport(int fd,
void* wakeup_buffer_,
unsigned long long nbytes)
{
return 0;
}

// stub out these symbols
extern "C" bool io_darwin_schedule_wakeup(void* waker) { return false; }

#endif
#endif // __APPLE__
10 changes: 1 addition & 9 deletions src/jsc/bindings/NoOrphansTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,4 @@ extern "C" void Bun__noOrphans_onFork() { Bun::NoOrphansTracker::get().scan(); }
extern "C" void Bun__noOrphans_onExit(pid_t pid) { Bun::NoOrphansTracker::get().onExit(pid); }
extern "C" void Bun__noOrphans_killTracked() { Bun::NoOrphansTracker::get().killTracked(); }

#else // !OS(DARWIN)

extern "C" void Bun__noOrphans_begin(int, int) {}
extern "C" void Bun__noOrphans_releaseKq() {}
extern "C" void Bun__noOrphans_onFork() {}
extern "C" void Bun__noOrphans_onExit(int) {}
extern "C" void Bun__noOrphans_killTracked() {}

#endif
#endif // OS(DARWIN)
12 changes: 1 addition & 11 deletions src/jsc/bindings/image_coregraphics_shim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,14 +592,4 @@ int64_t bun_coregraphics_clipboard_change_count()

} // extern "C"

#else
// Non-Apple: stubs so the link succeeds; callers only reference these on
// macOS so they're dead code, but LTO needs the definitions.
extern "C" int bun_coregraphics_decode(const void*, unsigned long, unsigned long long, void*, void*, void*) { return 1; }
extern "C" int bun_coregraphics_encode(const void*, unsigned, unsigned, int, int, void*, void*) { return 1; }
extern "C" int bun_coregraphics_scale(const void*, unsigned, unsigned, void*, unsigned, unsigned) { return 1; }
extern "C" int bun_coregraphics_rotate90(const void*, unsigned, unsigned, void*, unsigned) { return 1; }
extern "C" int bun_coregraphics_reflect(const void*, unsigned, unsigned, void*, int) { return 1; }
extern "C" int bun_coregraphics_clipboard(void*, void*, int) { return 1; }
extern "C" long long bun_coregraphics_clipboard_change_count() { return -1; }
#endif
#endif // defined(__APPLE__)
7 changes: 1 addition & 6 deletions src/jsc/bindings/image_wic_shim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,4 @@ extern "C" int32_t bun_wic_propbag_write_u8(void* props, const wchar_t* name, ui
return write1(props, name, VT_UI1, [](VARIANT& var) { var.bVal = v; });
}

#else
// Stubs so the symbols exist everywhere; backend_wic.rs is Windows-only so
// these are never called, but the linker wants them.
extern "C" int bun_wic_propbag_write_f32(void*, const void*, float) { return 0; }
extern "C" int bun_wic_propbag_write_u8(void*, const void*, unsigned char) { return 0; }
#endif
#endif // defined(_WIN32)
10 changes: 0 additions & 10 deletions src/resolver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2211,16 +2211,6 @@ pub mod cache {
}
}

impl From<Box<[u8]>> for Contents {
fn from(b: Box<[u8]>) -> Self {
if b.is_empty() {
Contents::Empty
} else {
Contents::Owned(b.into_vec())
}
}
}

/// Adapter for the canonical `fs::read_file_contents` (returns
/// `Cow<'buf,[u8]>` per the spec `PathContentsPair` shape). `Borrowed`
/// always points into the per-thread `shared_buffer` on the
Expand Down
Loading