Bob Andrews
9ba270d97b
Merge pull request #2378 from colinleroy/fix-overflow-in-malloc-and-realloc
...
Fix malloc and realloc overflow
2024-01-24 21:15:31 +01:00
Colin Leroy-Mira
5d49fde788
add a return -1 helper
2024-01-24 09:58:09 +01:00
Colin Leroy-Mira
3e01ac9b04
Fix malloc and realloc overflow
...
If user requests a size >= 65532, adding the heap admin size
overflows size. Fixes #2358 .
2024-01-24 09:54:54 +01:00
Colin Leroy-Mira
10282a9b74
Rewrite asctime() in assembler (-7 bytes)
2024-01-18 09:09:38 +01:00
Colin Leroy-Mira
03d5e5fba0
Rewrite mktime in assembly
...
-415 bytes,
-39% cycles,
Unit test expanded to cover more cases (there was a bug in 2100 before!)
2024-01-18 09:09:38 +01:00
Colin Leroy-Mira
348a9048b7
Convert _time_t_to_tm to asm
...
46 bytes size gain, -8% cycles on the unit tests
2024-01-18 09:09:31 +01:00
Bob Andrews
2127778239
Merge pull request #2336 from colinleroy/optimize-strdup
...
Optimize strdup
2024-01-08 22:13:43 +01:00
Colin Leroy-Mira
df193c0947
Rework time functions a bit
...
- mktime: Work unsigned as time_t's type implies (shifting Y2K38 bug to 2106)
- mktime: Add unit tests
- gmtime/localtime: factorize
- gmtime/localtime: Add unit tests
- mktime/gmtime/localtime: Size optimisation (-130 bytes wrt master)
- mktime: Speed optimisation (from 23M cycles on the unit test to 2M)
2024-01-08 18:24:13 +01:00
Colin Leroy-Mira
3a439e0e1b
Little strdup optimisation
...
-12 bytes on disk
-20 cycles per strdup
-6 cycles per strlen called from strdup
2024-01-07 14:25:06 +01:00
Colin Leroy-Mira
a90aa57510
Address Oliver's comments
2023-09-07 16:48:56 +02:00
Colin Leroy-Mira
dfe7562f76
Add ntohs, htons, ntohl, htons.
2023-09-07 07:03:34 +02:00
Christian Groessler
fedfc3443d
fix for issue #1973 (printf("%c", '\0') doesn't _write '\0' to fd 0)
2023-02-24 02:12:19 +01:00
mrdudz
5bda57de87
add extra underscore to _bzero, add a test for bzero/memset
2022-08-29 23:20:48 +02:00
mrdudz
3b03a96375
add underscores to _poserror and _stroserror
2022-08-29 21:06:48 +02:00
mrdudz
89c08dc6d4
extra underscores for _randomize and _swap
2022-08-29 20:52:35 +02:00
mrdudz
b09024aa32
add extra underscore to heap stuff
2022-08-29 19:55:48 +02:00
mrdudz
df4b6f9d14
remove extra spaces
2022-08-28 22:37:33 +02:00
mrdudz
54aff47513
fix some errno related stuff, "make all" works again
2022-08-28 22:09:44 +02:00
mrdudz
2dabb65ee0
fix errno related underscores in all libsrc/*.s files
2022-08-28 21:52:53 +02:00
mrdudz
f70020a2b8
use __sig_ign and __sig_dft instead of _sig_ign and _sig_dft
2022-08-28 20:18:34 +02:00
mrdudz
9246775ebe
use __afailed instead of _afailed
2022-08-28 20:08:13 +02:00
mrdudz
8e5f6b822d
fix setjmp.h
2022-08-28 20:05:11 +02:00
polluks2
7a93d3c707
Shorter isascii
2022-08-04 00:25:04 +02:00
Bob Andrews
6239fbe18c
Revert "rename '_poserror' to '__poserror'"
2022-07-24 18:14:21 +02:00
Christian Groessler
758d9466c0
rename '_poserror' to '__poserror'
...
The old name could be non-conforming to the C standard. The new name
is definitely in the "implementation name space".
See issue #1796 .
2022-07-24 00:33:56 +02:00
mrdudz
16bf472e66
reserve enough space for the longest string we can expect
2022-07-13 23:10:19 +02:00
mrdudz
f8f901b05e
remove dangling spaces
2022-04-17 16:06:22 +02:00
Jeff Tranter
2bf8be5b3b
Fix some commonly made spelling errors in comments.
2022-02-21 15:44:31 -05:00
Sven Michael Klose
0b84465276
Fix strnlen().
2021-12-25 09:11:58 +01:00
Sven Michael Klose
921e549172
Add standard C library function strnlen().
2021-12-24 23:44:57 +01:00
Greg King
884f72637b
Put the alignment decrement code back into posix_memalign().
...
Without that code, the function returns a very broken pointer.
2021-12-19 21:08:46 -05:00
Oliver Schmidt
2235830e31
Don't rely on (actually changed) unspecified compiler behavior.
2021-12-19 16:55:32 +01:00
Andrea Odetti
05f545e189
More line number related changes.
2021-05-11 17:41:59 +02:00
Polluks
4c37f12a4d
Optimised strlen
2021-05-08 19:36:37 +02:00
Greg King
216bb22b20
Added a special version of a function which uses an absolute addressing mode to access the zero page.
...
The PCEngine needs such operands to be redirected to RAM page $20 explicitly. Fixes #1482 ; fixes #1483 .
2021-05-04 12:10:43 -04:00
Oliver Schmidt
5d84a4ba13
Removed non-ASCII chars.
2021-04-19 16:06:10 +02:00
Greg King
d90cd11212
Fixed outdated comments.
2020-12-27 18:22:12 -05:00
Sven Michael Klose
9800555bbb
Remove stale comments.
2020-12-27 17:54:49 -05:00
Sven Michael Klose
9d62abb7ac
Fix comment.
2020-12-27 17:54:49 -05:00
Sven Michael Klose
f59cb9af06
Use more compact loops.
2020-12-27 17:54:49 -05:00
Sven Michael Klose
99c0815cdb
Clear up comments a bit.
2020-12-27 17:54:49 -05:00
Sven Michael Klose
3957310950
Knock off two bytes from getcwd(), cbm_read() and cbm_write().
2020-12-27 17:54:49 -05:00
acqn
63fa9a5a42
Fixed usage of "lvalue-cast" in _scanf implementation.
2020-08-24 17:16:37 +02:00
Oliver Schmidt
77674352f6
Minor style change.
2020-07-21 23:44:36 +02:00
Brad Smith
041f981960
rand() use XOR to break up unwanted pair correlation ( #1107 )
...
* rand() use XOR to break up unwanted pair correlation
This form of rand() cannot return the same value twice in a row.
Two additonal EOR instructions produce a more even distribution of successive pairs.
see comments on #951
* rand.s document purpose of XOR
* suggested srand() optimization: zero fill unnecessary
* test to validate implementation of rand()
* srand() improving behaviour and adding startup test
* srand() with a tail call to rand() for better initial shuffle
* srand() can fall through to rand() instead of tail call
2020-07-21 23:38:18 +02:00
Oliver Schmidt
0981c020b2
Shortened names and adjusted style.
2020-04-02 22:58:16 +02:00
Oliver Schmidt
411fe87f64
Fixed tolower() and toupper() to save high byte.
2020-04-02 22:14:22 +02:00
Oliver Schmidt
df015f4766
Adjusted tolower() and toupper() to https://github.com/cc65/cc65/pull/997
...
For some reason or another both the author of the PR in question and its reviewers didn't notice that the two functions in question were totally overlooked.
2020-04-02 11:15:53 +02:00
Oliver Schmidt
65dd931d22
Some style adjustments.
2020-04-02 10:42:06 +02:00
IrgendwerA8
08705a3fdc
Changes resulting from 2nd code review
2020-02-03 20:45:09 +01:00