Commit Graph

61 Commits

Author SHA1 Message Date
sourceturner 582e6eba69 Use unsafe blocks in some more unsafe functions
Building with redoxer showed some more places
that have to use unsafe blocks
2026-01-21 00:41:43 +01:00
Connor-GH cedd1686ba string.h: don't pollute the namespace with locale.h
Previously, we included all of `<locale.h>` in order to get `locale_t`.
This commit separates it into a `<bits/locale-t.h>` header (generated by
cbindgen) to better deal with this.
2026-01-20 14:29:08 -06:00
Connor-GH 0934bcf13e Implement strxfrm_l, strcoll_l, and strerror_l
These implementations are effectively the same as the ones in musl.
2026-01-19 16:58:54 -06:00
sourceturner f72ecfd8dc Use unsafe blocks in string.h implementation 2026-01-16 21:49:01 +00:00
Jeremy Soller 5265b732cc strtok_r: return the end of s in lasts when finished and only reference musl 2026-01-12 14:56:40 -07:00
Anhad Singh 5f256f91cd fix(string/memcmp): use read_unaligned where alignment is not guaranteed
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-01-02 00:52:40 +11:00
auronandace 98d90ac580 revert previous 2 changes and add Safety note 2025-12-24 14:32:08 +00:00
auronandace d4d82843de fix type 2025-12-24 12:56:30 +00:00
auronandace 16f1f71acb ensure internal memcpy does not copy past src or dest len 2025-12-24 12:42:28 +00:00
auronandace 4e744c3f55 only import the needed types 2025-12-24 11:05:12 +00:00
auronandace 96da8e5ed4 fix memccpy, copy correct amount of bytes and still copy if c not found 2025-12-24 11:02:15 +00:00
auronandace 0392c0b736 fix strlcat and strlcpy bytes amount 2025-12-17 14:56:59 +00:00
auronandace 6c62e7e401 fix strlcpy and strlcat 2025-12-15 07:58:44 +00:00
Wildan M 036dd3fb73 Avoid panic by unitialized string of strlen 2025-10-09 23:52:45 +07:00
Jeremy Soller 82084440ad Support nightly-2025-10-03 2025-10-03 21:51:10 -06:00
Josh Megnauth 1d5179eb71 Const calculate buffer size for strerror
The current buffer size is hard set to 256. Using const evaluation, the
maximum buf size can be calculated at compile time.
2025-07-10 03:18:17 +00:00
bjorn3 8650ac293e Fix building on targets with unsigned c_char 2025-03-30 16:35:29 +02:00
Jeremy Soller 90f30c5f51 Make NulTerminated::new return option 2025-01-09 13:33:56 -07:00
Darley Barreto ae5a5256b4 Add missing functions to string.h 2024-12-28 22:46:45 +00:00
Peter Limkilde Svendsen 93b6374d1e Reimplement memcpy() using slices, fix unaligned read/write, add test 2024-12-23 19:14:44 +00:00
Peter Limkilde Svendsen 2a7d01f02d Add docs for string.h, add missing functions 2024-11-19 00:20:40 +00:00
Peter Limkilde Svendsen 864d5e4795 Use only one .cast_mut() in memmem() 2024-11-17 20:19:52 +01:00
Peter Limkilde Svendsen 6a765ed88f Implement memmem() 2024-11-17 16:18:14 +00:00
Peter Limkilde Svendsen 41264dc8b1 Add NulTerminatedInclusive iterator, rewrite/fix strchr/wcschr 2024-10-22 22:12:24 +00:00
4lDO2 af6435e12d Implement psignal and psiginfo. 2024-09-24 19:34:53 +02:00
Peter Limkilde Svendsen 0a23acd401 Implement iterators on pointers 2024-09-22 23:42:28 +00:00
Peter Limkilde Svendsen a7137512fa Use standard casing and mangling for internal errno 2024-03-01 00:25:42 +00:00
Peter Limkilde Svendsen 9093f6bc47 Use Cell representation for errno 2024-02-29 14:07:40 +00:00
Jeremy Soller ab7e3da661 strsignal must return mutable char pointer 2023-09-09 09:22:26 -06:00
David Carlier 637dd22d3d stdio: implements legacy cuserid proposal. 2023-04-05 22:17:09 +01:00
David Carlier 34f2fff983 strlcpy/strlcat api for portability's sake.
those functions differently than the strn* ones as
they do not pad with zero to remaining bytes but guarantees
a null terminator.
2023-03-24 09:44:33 +00:00
jD91mZM2 b8c50c7c64 Format 2019-08-04 19:05:45 +02:00
jD91mZM2 c7d499d4f2 Upgrade to the 2018 edition
I didn't think it'd be this useful first, but thank god for `cargo fix --edition`!
2019-08-04 19:05:45 +02:00
jD91mZM2 e84ea94dd0 Execute fmt.sh 2019-06-12 14:45:33 +02:00
Jason Hansel a5409ecd36 Fix out-of-bounds error in strsignal 2019-06-10 10:25:59 -04:00
Mateusz Mikuła d62db7b1b9 Add memrchr() 2019-05-11 13:49:46 +02:00
Alex Lyon 5bbce37789 string: add strnlen_s() 2019-04-26 20:36:37 -07:00
Mateusz Mikuła 1ebd8a3d72 Handle zero length for strerror_r 2019-04-24 17:42:28 +02:00
Jeremy Soller 7bde036031 Remove va_list submodule, format 2019-04-21 15:45:55 -06:00
jD91mZM2 6d4ac9dba8 Finally, get rid of all rust warnings
Just a small step along the way to reduce the massive wall of spam
every time you compile.

This was done partly automagically with `cargo fix`. The rest was me
deleting or commenting out a bunch of variables. Hope nothing was
important...
2019-04-21 21:12:16 +02:00
jD91mZM2 3a3fd3da39 Use the memchr crate
https://github.com/BurntSushi/rust-memchr is supposed to be a whole
lot faster :)
2019-04-21 19:09:37 +02:00
jD91mZM2 601cb43f6c Merge branch 'strerror_r' into 'master'
Add POSIX strerror_r

See merge request redox-os/relibc!207
2019-04-21 15:06:17 +00:00
Mateusz Mikuła c68a0d5678 Add POSIX strerror_r 2019-04-19 17:59:56 +02:00
Michal Z 89ca696f8e Changed while loops to for
Changed while loops to for - https://gitlab.redox-os.org/redox-os/relibc/issues/128
2019-04-15 18:24:46 +02:00
Jeremy Soller fe57754c34 Do not cast usize to isize in strncpy 2018-12-02 08:16:38 -07:00
Jeremy Soller 52fd4d7e83 Clippy fixes 2018-12-02 08:04:53 -07:00
Jeremy Soller 9325183b21 Fix strcat 2018-12-01 08:55:02 -07:00
Jeremy Soller d66afa4586 Do not return mutable pointer from strsignal 2018-11-27 20:54:37 -07:00
Ian Douglas Scott fdd966629d Some type signature fixes found using script in #111 2018-11-25 20:58:02 -08:00
Jeremy Soller 0ac16556bc Format 2018-11-25 10:34:42 -07:00