summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2023-01-12 20:52:29 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2023-01-13 09:50:29 -0500
commit40355caefd3eaf3b52415777d29851ca988a26a4 (patch)
tree67a1662972e27e1a769db0c97b73d519f439a8c9
parent719d48afc45486f230249fef021baf2bc3833d99 (diff)
downloadrockbox-40355caefd.tar.gz
rockbox-40355caefd.zip
buflib_shrink use NULL to signal start isn't changing
Change-Id: Id3e86d3860b8ed860dc6dcbc394b1b8f9f3274b5
-rw-r--r--apps/filetypes.c2
-rw-r--r--apps/tagtree.c2
-rw-r--r--firmware/buflib.c2
-rw-r--r--firmware/chunk_alloc.c4
-rw-r--r--firmware/linuxboot.c2
5 files changed, 5 insertions, 7 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index d5cfc379c1..1944ee9383 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -414,7 +414,7 @@ static void read_viewers_config_init(void)
goto out;
read_config_init(fd);
- core_shrink(strdup_handle, core_get_data(strdup_handle), strdup_cur_idx);
+ core_shrink(strdup_handle, NULL, strdup_cur_idx);
out:
close(fd);
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 10e63ae210..11ea8ecf4e 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -1285,7 +1285,7 @@ static bool initialize_tagtree(void) /* also used when user selects 'Reload' in
add_event(PLAYBACK_EVENT_TRACK_BUFFER, tagtree_buffer_event);
add_event(PLAYBACK_EVENT_TRACK_FINISH, tagtree_track_finish_event);
- core_shrink(tagtree_handle, core_get_data(tagtree_handle), tagtree_buf_used);
+ core_shrink(tagtree_handle, NULL, tagtree_buf_used);
return true;
}
diff --git a/firmware/buflib.c b/firmware/buflib.c
index 0f8836b3b7..cb35290c03 100644
--- a/firmware/buflib.c
+++ b/firmware/buflib.c
@@ -894,7 +894,7 @@ bool
buflib_shrink(struct buflib_context* ctx, int handle, void* new_start, size_t new_size)
{
char* oldstart = buflib_get_data(ctx, handle);
- char* newstart = new_start;
+ char* newstart = new_start != NULL ? new_start : oldstart;
char* newend = newstart + new_size;
/* newstart must be higher and new_size not "negative" */
diff --git a/firmware/chunk_alloc.c b/firmware/chunk_alloc.c
index 6b80a475ab..85ad5d3489 100644
--- a/firmware/chunk_alloc.c
+++ b/firmware/chunk_alloc.c
@@ -172,12 +172,10 @@ static void finalize(struct chunk_alloc_header *hdr, struct chunk *chunk_array)
int handle = chunk_array[idx].handle;
struct buflib_context *ctx = hdr->context;
- void* chunk_start = buflib_get_data(ctx, handle);
-
hdr->chunk_bytes_total -= hdr->chunk_bytes_free;
hdr->chunk_bytes_free = 0;
- buflib_shrink(ctx, handle, chunk_start, hdr->chunk_bytes_total);
+ buflib_shrink(ctx, handle, NULL, hdr->chunk_bytes_total);
logf("%s shrink hdr idx[%ld] offset[%ld]: new size: %ld",
__func__, idx, chunk_array[idx].max_start_offset, hdr->chunk_bytes_total);
diff --git a/firmware/linuxboot.c b/firmware/linuxboot.c
index 74d87fbd64..6803bb466b 100644
--- a/firmware/linuxboot.c
+++ b/firmware/linuxboot.c
@@ -217,7 +217,7 @@ int uimage_load(struct uimage_header* uh, size_t* out_size,
if(ret)
goto err;
- core_shrink(out_h, core_get_data(out_h), *out_size);
+ core_shrink(out_h, NULL, *out_size);
ret = 0;
err: