rustybox icon indicating copy to clipboard operation
rustybox copied to clipboard

Lots of magic numbers

Open Akeboshiwind opened this issue 4 years ago • 1 comments

It seems like c2rust has removed a lot of the named constants so we've ended up with a bunch of magic numbers which are a lot less readable.

A good example might dumpkmap which has the following on line 77:

write(
  1i32,
  bb_common_bufsiz1.as_mut_ptr() as *const libc::c_void,
  (7i32 + 256i32) as size_t,
);

Versus the busybox version:

write(
  STDOUT_FILENO,
  flags,
  7 + MAX_NR_KEYMAPS
);

If and when someone gets c2rust refactor going this might be something good to tackle.

Akeboshiwind avatar Dec 29 '19 22:12 Akeboshiwind

It's worth mentioning that there are also a bunch of constants that are "declared" but that are copied across many different files and modules. Ultimately these should be de-duped.

samuela avatar Jan 06 '20 22:01 samuela