Skip to content

Commit 46010c4

Browse files
committed
Remove args cleanup code.
As of 91c3eee, the global ARGC and ARGV no longer reference dynamically-allocated memory, so they don't need to be cleaned up.
1 parent 64d171b commit 46010c4

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

library/std/src/sys/unix/args.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ pub unsafe fn init(argc: isize, argv: *const *const u8) {
1414
imp::init(argc, argv)
1515
}
1616

17-
/// One-time global cleanup.
18-
pub unsafe fn cleanup() {
19-
imp::cleanup()
20-
}
21-
2217
/// Returns the command line arguments
2318
pub fn args() -> Args {
2419
imp::args()
@@ -127,12 +122,6 @@ mod imp {
127122
init_wrapper
128123
};
129124

130-
pub unsafe fn cleanup() {
131-
let _guard = LOCK.lock();
132-
ARGC.store(0, Ordering::Relaxed);
133-
ARGV.store(ptr::null_mut(), Ordering::Relaxed);
134-
}
135-
136125
pub fn args() -> Args {
137126
Args { iter: clone().into_iter() }
138127
}
@@ -159,8 +148,6 @@ mod imp {
159148

160149
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {}
161150

162-
pub fn cleanup() {}
163-
164151
#[cfg(target_os = "macos")]
165152
pub fn args() -> Args {
166153
use crate::os::unix::prelude::*;

library/std/src/sys/unix/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ pub unsafe fn init(argc: isize, argv: *const *const u8) {
123123
// SAFETY: must be called only once during runtime cleanup.
124124
// NOTE: this is not guaranteed to run, for example when the program aborts.
125125
pub unsafe fn cleanup() {
126-
args::cleanup();
127126
stack_overflow::cleanup();
128127
}
129128

0 commit comments

Comments
 (0)