AVR C Runtime Library - Bugs: bug #44306, Redundancy between rand_r() and...
You are not allowed to post comments on this tracker with your current authentication level.
bug #44306: Redundancy between rand_r() and do_rand()
Submitter: | None | ||
Submitted: | Thu 19 Feb 2015 09:30:50 AM UTC | ||
Category: | Library | Severity: | 3 - Normal |
Priority: | 5 - Normal | Item Group: | libc code |
Status: | None | Assigned to: | None |
Percent Complete: | 0% | Originator Email: | -email is unavailable- |
Open/Closed: | Open | Release: | Any |
Fixed Release: | None |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
No changes have been made to this item
Powered by Savane 3.13-758e.
Corresponding source code
In libc/stdlib/rand.c, the functions rand_r() and do_rand() are
redundant relative to each other. I suggest the following:
- remove rand_r(),
- remove the "static" attribute from do_rand(),
- rename do_rand() -> rand_r(),
- have rand() call rand_r() instead of do_rand().
This should save 4 bytes of flash on every program using rand() or
rand_r(). It should also save 2 bytes of stack and 7 clock cycles on
calls to rand_r(), more if _AVR_3_BYTE_PC_.
Same thing for random_r() and do_random() in libc/stdlib/random.c.