Skip to content

Commit 07e746a

Browse files
committed
remvoe dead code
1 parent 94c1508 commit 07e746a

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

src/args.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ pub struct StartContext {
5959
pub struct EnvEdit {
6060
pub entry: *const *const u8,
6161
pub old_string: *const u8,
62-
pub new_string: *const u8,
6362
}
6463

6564
struct StackShifter<'a> {
@@ -195,28 +194,6 @@ impl Args {
195194
explode("The handoff function returned");
196195
}
197196

198-
/// Creates a new environment variable.
199-
pub fn add_env<F>(&mut self, name: &str, value_len: usize, f: F) -> Result<*const u8, ()>
200-
where
201-
F: FnOnce(&mut [u8]),
202-
{
203-
if self.extra_env.is_some() {
204-
return Err(());
205-
}
206-
207-
let name_len = name.len();
208-
let whole_len = name_len + 1 + value_len;
209-
let new_buf = new_slice_leak(whole_len + 1).unwrap();
210-
new_buf[..name_len].copy_from_slice(name.as_bytes());
211-
new_buf[name_len] = b'=';
212-
new_buf[whole_len] = 0;
213-
214-
f(&mut new_buf[name_len + 1..whole_len]);
215-
216-
self.extra_env = Some(new_buf.as_ptr());
217-
Ok(new_buf.as_ptr())
218-
}
219-
220197
pub fn iter_env(&mut self) -> Option<EnvIter> {
221198
if self.env_iterated {
222199
return None;
@@ -309,7 +286,6 @@ impl VarHandle {
309286
EnvEdit {
310287
entry: self.ptr,
311288
old_string: old_buf,
312-
new_string: new_buf.as_ptr(),
313289
}
314290
}
315291

src/main.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,6 @@ extern "C" fn real_main() -> ! {
152152
} else {
153153
log::info!("Neither LD_LIBRARY_PATH or NIX_LD_LIBRARY_PATH exist - Setting default");
154154

155-
let new_env = args
156-
.add_env(
157-
"LD_LIBRARY_PATH",
158-
DEFAULT_NIX_LD_LIBRARY_PATH.len(),
159-
|buf| {
160-
buf.copy_from_slice(DEFAULT_NIX_LD_LIBRARY_PATH);
161-
},
162-
)
163-
.unwrap();
164-
165155
// If the entry trampoline is available on the platform, LD_LIBRARY_PATH
166156
// will be replaced with an empty LD_LIBRARY_PATH when ld.so launches
167157
// the actual program.
@@ -171,7 +161,6 @@ extern "C" fn real_main() -> ! {
171161
EnvEdit {
172162
entry: ptr::null(),
173163
old_string: EMPTY_LD_LIBRARY_PATH_ENV.as_ptr().cast(),
174-
new_string: new_env,
175164
}
176165
};
177166

0 commit comments

Comments
 (0)