Skip to content

Commit

Permalink
made dereferencing more consistent
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin Läufer <laufer@cs.luc.edu>
  • Loading branch information
klaeufer committed Mar 18, 2024
1 parent 19df7ff commit 88d659e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bin/fakeps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn main() {
println!("{:>10}{:>10} CMD", "PID", "PPID");
for (ppid, children) in ps.iter().enumerate() {
for pid in children {
println!("{:>10}{:>10} Fake process {}", *pid, ppid, pid);
println!("{:>10}{:>10} Fake process {}", pid, ppid, pid);
}
}
}
6 changes: 3 additions & 3 deletions src/bin/processtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ fn build_tree(processes: Vec<Process>) -> ProcessTree {
/// Prints a process tree with indentation.
fn print_tree(tree: &ProcessTree, pid: usize, depth: usize) {
if let Some(processes) = tree.get(&pid) {
for (pid, _, cmd) in processes {
println!("{:indent$}{}: {}", "", pid, cmd, indent = depth * 2);
print_tree(tree, *pid, depth + 1);
for (cid, _, cmd) in processes {
println!("{:indent$}{}: {}", "", *cid, cmd, indent = depth * 2);
print_tree(tree, *cid, depth + 1);
}
}
}
Expand Down

0 comments on commit 88d659e

Please sign in to comment.