1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00
Commit Graph

563 Commits

Author SHA1 Message Date
Sebastian Bauer
eb1d784c0d Provide stub for mbrtowc(). 2018-03-30 21:21:11 +02:00
Sebastian Bauer
d1092099d0 Provide some more wide char functions. 2018-03-29 20:59:02 +02:00
Sebastian Bauer
bc621bed9c Disable the LOG_COMMAND.
Piping will have the consequence that the exit status of the first command
will not be considered. As this is the compiling command in our case, make
will not exit with an error code even if the compiling failed.

While there are shell-specific solutions, disabling LOG_COMMAND seems to
be the most general solution.
2018-03-29 20:57:32 +02:00
Sebastian Bauer
60eebbe732 Implement wcscat(). 2018-03-28 21:23:13 +02:00
Sebastian Bauer
345995000a Implement some more of the iswXXX() functions. 2018-03-28 21:16:14 +02:00
Sebastian Bauer
ef18bf5f3e Fix vswprintf() prototype. 2018-03-28 18:47:24 +02:00
Sebastian Bauer
6f3b3b6d28 Implement few wide char functions. 2018-03-28 17:09:18 +02:00
Sebastian Bauer
846eebc66c Fix mbtowc() to and compile it. 2018-03-28 17:08:42 +02:00
Sebastian Bauer
75d47ccdad Build all existing wchar and wctype functions. 2018-03-27 20:03:45 +02:00
Sebastian Bauer
456123fe7f Add dummy wctob(). 2018-03-27 20:02:54 +02:00
Sebastian Bauer
5733c99ba1 Fix wcspbrk() definition to match the prototype. 2018-03-27 20:00:28 +02:00
Sebastian Bauer
391e7e39ad Add wcscoll() prototype. 2018-03-27 19:59:54 +02:00
Sebastian Bauer
f5f0e17e78 Define ISO 99 multibyte functions also in C++ context. 2018-03-27 19:59:23 +02:00
Sebastian Bauer
f6f0082a0e Include sys/clib2_stdc.h for restrict. 2018-03-27 19:56:45 +02:00
obarthel
c84b1fc1ff Tiny fixes 2018-02-18 13:58:25 +01:00
Henning Nielsen Lund
911114c286 add an unimplemented tzset().
ctime_r() and localtime_r() are already using the localtime, so no need to do anything.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/tzset.html

Signed-off-by: Henning Nielsen Lund <hnl_dk@amigaos.dk>
2017-08-27 13:30:12 +02:00
Henning Nielsen Lund
9e998ca108 should have been sys/clib2_stdc.h 2017-08-15 21:53:49 +02:00
Henning Nielsen Lund
99695dec0b we use restrict
Signed-off-by: Henning Nielsen Lund <hnl_dk@amigaos.dk>
2017-08-15 21:45:33 +02:00
Henning Nielsen Lund
0ec7094877 Code depending on statfs or fstatfs do both depend on sys/mount.h and sys/param.h where we only had sys/mount.h
Signed-off-by: Henning Nielsen Lund <hnl_dk@amigaos.dk>
2017-08-15 21:26:45 +02:00
Henning Nielsen Lund
a471e73adf add timespec declaration 2017-08-05 17:28:39 +02:00
Henning Nielsen Lund
c76bf8e20b add strnlen() 2017-08-01 21:28:07 +02:00
Henning Nielsen Lund
309bbd8c8c Add a few extra wide-character prototypes and the missing typedef locale_t 2017-08-01 21:26:59 +02:00
Henning Nielsen Lund
d6e5769bc5 using restrict, so restrict to c99 2017-08-01 14:52:45 +02:00
Henning Nielsen Lund
976b6ae7e1 Change the mbrlen declaration to equal ISO C.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrlen.html

Signed-off-by: Henning Nielsen Lund <hnl_dk@amigaos.dk>
2017-08-01 13:55:11 +02:00
obarthel
8af96cb6cb Merge branch 'master' of https://github.com/adtools/clib2 2017-07-08 18:10:45 +02:00
obarthel
febe690623 This got lost last year
The missing calloc() overflow test never made it to the CVS or git repositories :-(
2017-07-08 18:10:28 +02:00
Steven Solie
6a1fd36b3a Revision bump. 2017-06-28 06:35:31 +02:00
Steven Solie
feebeb6751 GCC 5 changes 2017-06-28 06:34:57 +02:00
obarthel
1b2c798467 Fixed calloc() and getopt_long()
Added integer overflow test to calloc().

Tiny change in getopt_long() so that the value pointed to by the "longindex" parameter is always initialized to an invalid index position (that being -1), instead of 0. The value of 0 can break some shell commands, most notably GNU wget.
2017-05-01 18:06:23 +02:00
obarthel
4c54ee3f2d Version bump 2016-12-04 11:14:17 +01:00
obarthel
f491e38b38 Added code to temporarily disable profiling 2016-12-04 11:14:00 +01:00
obarthel
734ce4c1a9 Added code to temporarily disable profiling 2016-12-04 11:13:37 +01:00
obarthel
ce345df9da Hide warnings for deprecated functions 2016-12-04 11:13:00 +01:00
obarthel
5e0fa78d61 Only builds with GCC now 2016-12-04 11:12:42 +01:00
obarthel
bc3e19abe5 Only uses MEMF_PRIVATE on OS4 now 2016-12-04 11:12:32 +01:00
obarthel
8beaabac4f Removed unused local variable 2016-12-04 11:10:46 +01:00
obarthel
271572ed56 Fixed so that it builds correctly with SAS/C again 2016-12-04 11:10:33 +01:00
obarthel
e0feef8932 Moved __CXV54 into sas_cxv.asm
sas_cxv54.asm is no longer needed.
2016-12-04 11:10:13 +01:00
obarthel
07259ed7eb This is needed when building with math=ieee option 2016-12-04 11:09:24 +01:00
obarthel
3203fcf96a Removed unused result variable 2016-12-04 11:08:54 +01:00
obarthel
bfba44bf83 Rewritten to use setjmp()/longjmp()
Also contains new code which prints the number of times a slab was reused.
2016-12-04 11:08:41 +01:00
obarthel
35434bdedc Updated to build correctly with SAS/C again 2016-12-04 11:07:40 +01:00
obarthel
17ba18c731 Added code which temporarily disables profiling 2016-12-04 11:06:50 +01:00
obarthel
78a8c7655e Added __decay_unused_slabs() 2016-12-04 11:05:50 +01:00
obarthel
184a127860 Added stdlib_decay_unused_slabs() 2016-12-04 11:05:30 +01:00
obarthel
5617c0eacf Slab allocator update
Unused slabs which get recycled are no longer reinitialized from scratch if their chunk size matches what the allocator needed. If the chunk size matches, the list of available chunks is left unchanged, and just the various counters are reset.

Added __get_slab_stats() function.

Added support for global __slab_purge_threshold tuning variable.

Added a short test program for the slab allocator.

The malloc-test program was linked against the wrong object file in GNUmakefile.68k. Fixed.
2016-11-27 15:53:40 +01:00
Olaf Barthel
ac710b333e Accidentally omitted from version 1.211 2016-11-24 09:45:35 +01:00
Olaf Barthel
d2acae7cd7 Slab allocator update
Added more consistency checking to the slab allocator, which is built if DEBUG is defined in "stdlib_slab.c".

Memory allocations are no longer guaranteed to be aligned to 64 bit word boundaries. In fact, this has not even worked reliably in the past 10 years.

Memory allocation request sizes are now rounded to multiples of 32 bit words (the size of an address pointer) instead to the size of a 64 bit word.

Reduced the memory footprint of the memory allocation management data structures by reusing the most significant bit of the memory allocation size. This allows many more allocations to fit into the 32 byte chunk slabs, but limits the maximum memory allocation size to a little less than 2 GBytes.

Added integer overflow checks to the memory management code.

Reduced the memory management overhead further. This cuts an additional 8 bytes per allocation, unless neither the slab allocator nor memory pools are available. With this reduction the slab allocator is able to use 16 byte chunks, which cover memory allocation requests of 1..8 bytes.

Fixed a bug caused by returning an allocation back to a slab which passed the wrong pointer.
2016-11-23 16:37:46 +01:00
Olaf Barthel
0c5b88d2d3 Slab allocator changes
If the first slab in the list of slabs which share the same chunk size has no more room, it means that all other slabs following it have no room either. This speeds up the test to find a slab with free space, which can now abort and directly proceed to allocate memory for a new slab.

If an empty slab's decay count hits zero, it is moved to the front of the empty slab list to be reclaimed more quickly.

Allocations made from the slab now carry a pointer back to the slab which they are a part of. This speeds up deallocation but has the downside of making the smallest usable slab chunk size 64 bytes, which is double what used to be the minimum before.
2016-11-22 11:07:38 +01:00
Olaf Barthel
1ea8953bd3 Added __get_slab_allocations() function
__get_slab_allocations() which will report information about each memory allocation made by the slab allocator which does not come from a slab.
2016-11-22 11:06:29 +01:00