rockbox/firmware/include
William Wilgus 7faf6be35f chunk_alloc
chunk_alloc allows arrays (or any data) to be allocated in smaller chunks

you have to save the indices..
 variable data will have variable indices you need to
 store these as [chunk_alloc] doesn't keep track
 if you have a fixed size for each
 alloc you can do indice / sizeof(data)
 or index * sizeof(data) to convert

Lots of debug stuff still in and it needs optimization

User provides chunk_size and max_chunks
max_chunks * struct chunk will be allocated at start
with (1) chunk_size allocation initially

alloc_chunk() with size = 0 shrinks the last allocation to the size of the data used

add OOM checks on buflib_alloc -- oops

move bytes available to the header -- less memory per chunk & better alignment
keep track of the current in use chunk index -- should speed things up a bit

Now allows:
realloc chunk header
larger allocations than chunk size

reallocs smaller than existing will shrink the current array
rather than alloc a new and copy data

Comments welcome :)

Change-Id: I8ed170eef73da95da19430a80b32e5debf0c8276
2023-01-10 23:59:19 -05:00
..
_ansi.h
adler32.h adler32: import adapted implementation from tinf/zlib 2021-07-30 23:11:49 +00:00
ap_int.h Add proper float formatting to vuprintf 2019-07-19 22:07:41 -04:00
assert.h
bitarray.h Agptek Rocker: Initial commit 2018-06-12 10:31:14 +02:00
buflib.h buflib: add pin/unpin operation 2022-09-19 15:09:51 -04:00
checksum.h rockbox: move firmware checksum algorithms into a common header 2020-11-22 05:12:04 +00:00
chunk_alloc.h chunk_alloc 2023-01-10 23:59:19 -05:00
core_alloc.h chunk_alloc 2023-01-10 23:59:19 -05:00
crc32-rkw.h
crc32.h rockbox: add a crc32 reverse polynomial function 2021-06-21 03:37:17 +00:00
dbgcheck.h
diacritic.h
dir.h Fix path handling snafu for CheckWPS tool 2017-01-16 07:30:39 -05:00
dircache.h Restore dircache hookup in the database ramcache. 2017-02-10 05:05:23 -05:00
dircache_redirect.h [BugFix] root redirect failed to match the peoper drive when internal drive is missing 2022-12-18 23:32:13 -05:00
disk_cache.h Do some housekeeping with fat.h and SECTOR_SIZE 2017-03-12 22:05:44 -04:00
file.h file/fat: rework utime function as modtime extension 2021-07-08 17:47:51 +00:00
file_internal.h [RESTORED!] Allow mounting of any directory as the root directory. 2022-03-03 18:58:07 -05:00
fileobj_mgr.h [RESTORED!] Allow mounting of any directory as the root directory. 2022-03-03 18:58:07 -05:00
filesystem-native.h file/fat: rework utime function as modtime extension 2021-07-08 17:47:51 +00:00
font_cache.h
fs_attr.h Rewrite filesystem code (WIP) 2014-08-30 03:48:23 +02:00
fs_defines.h increase the number of file & directory handles for devices with more ram 2022-11-14 08:21:29 -05:00
gcc_extensions.h
inflate.h inflate: Add helper for getting decompressed data size 2022-03-04 08:44:56 -05:00
linked_list.h linked list: add lld_insert_prev/next() 2022-10-16 16:10:24 +01:00
loader_strerror.h
lru.h
memset16.h
rb-loader.h multiboot: Refactor duplicated functions to a separate file 2022-03-11 10:58:20 -05:00
rb_namespace.h [RESTORED!] Allow mounting of any directory as the root directory. 2022-03-03 18:58:07 -05:00
rbendian.h firmware: Add load/store with endianness functions 2022-06-26 17:19:40 +01:00
rbunicode.h [4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice. 2020-07-24 21:20:13 +00:00
strcasecmp.h
strcasestr.h
string-extra.h replace strlcpy with strmemccpy 2022-11-14 23:56:16 -05:00
strlcat.h
strlcpy.h
strmemccpy.h replace strlcpy with strmemccpy 2022-11-14 23:56:16 -05:00
strnatcmp.h
strptokspn_r.h make splash split on control characters 2022-11-12 06:22:16 -05:00
strtok_r.h
timefuncs.h timefuncs: add dostime_localtime function 2021-07-07 17:31:00 +00:00
version.h Prevent spurious recompiles on account of changed version. 2014-08-28 15:48:56 +02:00
vuprintf.h Implement a much more capable vuprintf() 2017-11-21 05:00:27 -05:00
zip.h zip: implement zip extraction support 2021-07-11 05:14:20 +00:00