summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-10-15 23:55:39 +0100
committerAidan MacDonald <amachronic@protonmail.com>2023-01-13 10:32:54 +0000
commit1e9ad3ca0d9bf3e917eb2beb460421155144760a (patch)
tree752590b42f338f03223e024fc5b642ac9a8a5598
parent3301c5aa6db76832dbb9af8f72d29b348190fd91 (diff)
downloadrockbox-1e9ad3ca0d.tar.gz
rockbox-1e9ad3ca0d.zip
Remove buflib allocation names, part two
Remove allocation names from the buflib API and fix up all callers. Change-Id: I3df922e258d5f0d711d70e72b56b4ed634fb0f5a
-rw-r--r--apps/action.c2
-rw-r--r--apps/core_keymap.c2
-rw-r--r--apps/debug_menu.c2
-rw-r--r--apps/filetypes.c2
-rw-r--r--apps/gui/skin_engine/skin_backdrops.c5
-rw-r--r--apps/gui/skin_engine/skin_parser.c3
-rw-r--r--apps/iap/iap-core.c2
-rw-r--r--apps/misc.c4
-rw-r--r--apps/playback.c2
-rw-r--r--apps/playlist.c9
-rw-r--r--apps/plugin.c4
-rw-r--r--apps/plugin.h5
-rw-r--r--apps/radio/radioart.c2
-rw-r--r--apps/rbcodec_helpers.c2
-rw-r--r--apps/recorder/pcm_record.c2
-rw-r--r--apps/shortcuts.c9
-rw-r--r--apps/tagcache.c6
-rw-r--r--apps/tagtree.c2
-rw-r--r--apps/talk.c4
-rw-r--r--apps/tree.c9
-rw-r--r--apps/voice_thread.c2
-rw-r--r--bootloader/x1000/boot.c2
-rw-r--r--bootloader/x1000/utils.c2
-rw-r--r--firmware/buflib.c17
-rw-r--r--firmware/common/dircache.c2
-rw-r--r--firmware/common/unicode.c8
-rw-r--r--firmware/common/zip.c2
-rw-r--r--firmware/core_alloc.c20
-rw-r--r--firmware/font.c2
-rw-r--r--firmware/include/buflib.h23
-rw-r--r--firmware/include/core_alloc.h7
-rw-r--r--firmware/linuxboot.c4
-rw-r--r--firmware/rolo.c2
-rw-r--r--firmware/target/arm/ata-nand-telechips.c2
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c2
-rw-r--r--firmware/target/mips/ingenic_x1000/installer-x1000.c2
-rw-r--r--firmware/usbstack/usb_storage.c3
-rw-r--r--lib/rbcodec/dsp/pbe.c2
-rw-r--r--lib/rbcodec/dsp/surround.c2
39 files changed, 69 insertions, 115 deletions
diff --git a/apps/action.c b/apps/action.c
index 20145a5bc1..208fea4a97 100644
--- a/apps/action.c
+++ b/apps/action.c
@@ -1202,7 +1202,7 @@ int action_set_keymap(struct button_mapping* core_keymap, int count)
return action_set_keymap_handle(0, 0);
size_t keyremap_buf_size = count * sizeof(struct button_mapping);
- int handle = core_alloc("keyremap", keyremap_buf_size);
+ int handle = core_alloc(keyremap_buf_size);
if (handle < 0)
return -6;
diff --git a/apps/core_keymap.c b/apps/core_keymap.c
index 9d54fcffac..966f32057a 100644
--- a/apps/core_keymap.c
+++ b/apps/core_keymap.c
@@ -77,7 +77,7 @@ int core_load_key_remap(const char *filename)
return -1;
size_t bufsize = count * sizeof(struct button_mapping);
- int handle = core_alloc("keyremap", bufsize);
+ int handle = core_alloc(bufsize);
if (handle > 0)
{
core_pin(handle);
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 71c0395e6e..65b660813f 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -515,7 +515,7 @@ static int bf_action_cb(int action, struct gui_synclist* list)
else
{
splash(HZ/1, "Attempting a 64k allocation");
- int handle = core_alloc("test", 64<<10);
+ int handle = core_alloc(64<<10);
splash(HZ/2, (handle > 0) ? "Success":"Fail");
/* for some reason simplelist doesn't allow adding items here if
* info.get_name is given, so use normal list api */
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 03f3cfa994..d5cfc379c1 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -409,7 +409,7 @@ static void read_viewers_config_init(void)
/* estimate bufsize with the filesize, will not be larger */
strdup_bufsize = (size_t)filesz;
- strdup_handle = core_alloc_ex("filetypes", strdup_bufsize, &ops);
+ strdup_handle = core_alloc_ex(strdup_bufsize, &ops);
if(strdup_handle <= 0)
goto out;
diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c
index 8be40d1ce2..eecf5b0433 100644
--- a/apps/gui/skin_engine/skin_backdrops.c
+++ b/apps/gui/skin_engine/skin_backdrops.c
@@ -174,7 +174,7 @@ bool skin_backdrops_preload(void)
}
if (*filename && *filename != '-')
{
- backdrops[i].buflib_handle = core_alloc_ex(filename, buf_size, &buflib_ops);
+ backdrops[i].buflib_handle = core_alloc_ex(buf_size, &buflib_ops);
if (backdrops[i].buflib_handle > 0)
{
backdrops[i].buffer = core_get_data(backdrops[i].buflib_handle);
@@ -287,8 +287,7 @@ void skin_backdrop_load_setting(void)
if (backdrops[i].buflib_handle <= 0)
{
backdrops[i].buflib_handle =
- core_alloc_ex(global_settings.backdrop_file,
- LCD_BACKDROP_BYTES, &buflib_ops);
+ core_alloc_ex(LCD_BACKDROP_BYTES, &buflib_ops);
if (backdrops[i].buflib_handle <= 0)
return;
}
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index d99394eed0..6cc3c596b0 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -2574,8 +2574,7 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
}
#endif
#ifndef __PCTOOL__
- wps_data->buflib_handle = core_alloc(isfile ? buf : "failsafe skin",
- skin_buffer_usage());
+ wps_data->buflib_handle = core_alloc(skin_buffer_usage());
if (wps_data->buflib_handle > 0)
{
wps_data->wps_loaded = true;
diff --git a/apps/iap/iap-core.c b/apps/iap/iap-core.c
index d2095b65bd..da04a67311 100644
--- a/apps/iap/iap-core.c
+++ b/apps/iap/iap-core.c
@@ -453,7 +453,7 @@ static void iap_malloc(void)
return;
#ifdef IAP_MALLOC_DYNAMIC
- iap_buffer_handle = core_alloc_ex("iap", IAP_MALLOC_SIZE, &iap_buflib_callbacks);
+ iap_buffer_handle = core_alloc_ex(IAP_MALLOC_SIZE, &iap_buflib_callbacks);
if (iap_buffer_handle < 0)
panicf("Could not allocate buffer memory");
iap_buffers = core_get_data(iap_buffer_handle);
diff --git a/apps/misc.c b/apps/misc.c
index 36f45d46e0..93b5247ae9 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -1606,9 +1606,7 @@ int core_load_bmp(const char * filename, struct bitmap *bm, const int bmformat,
if (buf_size > 0)
{
-
- handle = core_alloc_ex(filename, (size_t) buf_size, ops);
-
+ handle = core_alloc_ex(buf_size, ops);
if (handle > 0)
{
core_pin(handle);
diff --git a/apps/playback.c b/apps/playback.c
index c4d84145b2..f298764a22 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -997,7 +997,7 @@ static void audio_reset_buffer(void)
}
if (core_allocatable() < (1 << 10))
talk_buffer_set_policy(TALK_BUFFER_LOOSE); /* back off voice buffer */
- audiobuf_handle = core_alloc_maximum("audiobuf", &filebuflen, &ops);
+ audiobuf_handle = core_alloc_maximum(&filebuflen, &ops);
if (audiobuf_handle > 0)
audio_reset_buffer_noalloc(core_get_data(audiobuf_handle));
diff --git a/apps/playlist.c b/apps/playlist.c
index 25bd60dd2a..481524b9d4 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -2020,7 +2020,7 @@ static void alloc_namebuffer(void)
static int alloc_tempbuf(size_t* buflen)
{
/* request a reasonable size first */
- int handle = core_alloc_ex(NULL, PLAYLIST_LOAD_BUFLEN, &buflib_ops_locked);
+ int handle = core_alloc_ex(PLAYLIST_LOAD_BUFLEN, &buflib_ops_locked);
if (handle > 0)
{
*buflen = PLAYLIST_LOAD_BUFLEN;
@@ -2028,7 +2028,7 @@ static int alloc_tempbuf(size_t* buflen)
}
/* otherwise, try being unreasonable */
- return core_alloc_maximum(NULL, buflen, &buflib_ops_locked);
+ return core_alloc_maximum(buflen, &buflib_ops_locked);
}
/*
@@ -2075,15 +2075,14 @@ void playlist_init(void)
playlist->fd = -1;
playlist->control_fd = -1;
playlist->max_playlist_size = global_settings.max_files_in_playlist;
- handle = core_alloc_ex("playlist idx",
- playlist->max_playlist_size * sizeof(*playlist->indices), &ops);
+ handle = core_alloc_ex(playlist->max_playlist_size * sizeof(*playlist->indices), &ops);
playlist->indices = core_get_data(handle);
initalize_new_playlist(playlist, true);
#ifdef HAVE_DIRCACHE
- handle = core_alloc_ex("playlist dc",
+ handle = core_alloc_ex(
playlist->max_playlist_size * sizeof(*playlist->dcfrefs), &ops);
playlist->dcfrefs = core_get_data(handle);
dc_copy_filerefs(playlist->dcfrefs, NULL, playlist->max_playlist_size);
diff --git a/apps/plugin.c b/apps/plugin.c
index 7c6e91424a..38b7b6e821 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -585,7 +585,6 @@ static const struct plugin_api rockbox_api = {
buflib_free,
buflib_shrink,
buflib_get_data,
- buflib_get_name,
/* sound */
sound_set,
@@ -1039,8 +1038,7 @@ static void* plugin_get_audio_buffer(size_t *buffer_size)
{
if (plugin_buffer_handle <= 0)
{
- plugin_buffer_handle = core_alloc_maximum("plugin audio buf",
- &plugin_buffer_size,
+ plugin_buffer_handle = core_alloc_maximum(&plugin_buffer_size,
&buflib_ops_locked);
}
diff --git a/apps/plugin.h b/apps/plugin.h
index 768fc0ff27..0e7e97433b 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -649,8 +649,8 @@ struct plugin_api {
size_t (*buflib_available)(struct buflib_context* ctx);
int (*buflib_alloc)(struct buflib_context* ctx, size_t size);
int (*buflib_alloc_ex)(struct buflib_context* ctx, size_t size,
- const char* name, struct buflib_callbacks *ops);
- int (*buflib_alloc_maximum)(struct buflib_context* ctx, const char* name,
+ struct buflib_callbacks *ops);
+ int (*buflib_alloc_maximum)(struct buflib_context* ctx,
size_t* size, struct buflib_callbacks *ops);
void (*buflib_buffer_in)(struct buflib_context* ctx, int size);
void* (*buflib_buffer_out)(struct buflib_context* ctx, size_t* size);
@@ -658,7 +658,6 @@ struct plugin_api {
bool (*buflib_shrink)(struct buflib_context* ctx, int handle,
void* new_start, size_t new_size);
void* (*buflib_get_data)(struct buflib_context* ctx, int handle);
- const char* (*buflib_get_name)(struct buflib_context* ctx, int handle);
/* sound */
void (*sound_set)(int setting, int value);
diff --git a/apps/radio/radioart.c b/apps/radio/radioart.c
index 230948c051..ce774ac4b1 100644
--- a/apps/radio/radioart.c
+++ b/apps/radio/radioart.c
@@ -202,7 +202,7 @@ void radioart_init(bool entering_screen)
{
/* grab control over buffering */
size_t bufsize;
- int handle = core_alloc_maximum("radioart", &bufsize, &radioart_ops);
+ int handle = core_alloc_maximum(&bufsize, &radioart_ops);
if (handle <0)
{
splash(HZ, "Radioart Failed - OOM");
diff --git a/apps/rbcodec_helpers.c b/apps/rbcodec_helpers.c
index b856d7355d..197c0d4595 100644
--- a/apps/rbcodec_helpers.c
+++ b/apps/rbcodec_helpers.c
@@ -64,7 +64,7 @@ bool tdspeed_alloc_buffers(int32_t **buffers, const int *buf_s, int nbuf)
{
if (handles[i] <= 0)
{
- handles[i] = core_alloc_ex("tdspeed", buf_s[i], &ops);
+ handles[i] = core_alloc_ex(buf_s[i], &ops);
if (handles[i] <= 0)
return false;
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c
index f7f4c77928..8dc2c150fd 100644
--- a/apps/recorder/pcm_record.c
+++ b/apps/recorder/pcm_record.c
@@ -1408,7 +1408,7 @@ static void on_init_recording(void)
send_event(RECORDING_EVENT_START, NULL);
/* FIXME: This buffer should play nicer and be shrinkable/movable */
talk_buffer_set_policy(TALK_BUFFER_LOOSE);
- pcmrec_handle = core_alloc_maximum("pcmrec", &rec_buffer_size, &buflib_ops_locked);
+ pcmrec_handle = core_alloc_maximum(&rec_buffer_size, &buflib_ops_locked);
if (pcmrec_handle <= 0)
/* someone is abusing core_alloc_maximum(). Fix this evil guy instead of
* trying to handle OOM without hope */
diff --git a/apps/shortcuts.c b/apps/shortcuts.c
index 3f13d0c1b3..2e10bad00f 100644
--- a/apps/shortcuts.c
+++ b/apps/shortcuts.c
@@ -128,8 +128,7 @@ static struct shortcut* get_shortcut(int index)
if (first_handle == 0)
{
- first_handle = core_alloc_ex("shortcuts_head",
- sizeof(struct shortcut_handle), &shortcut_ops);
+ first_handle = core_alloc_ex(sizeof(struct shortcut_handle), &shortcut_ops);
if (first_handle <= 0)
return NULL;
h = core_get_data(first_handle);
@@ -146,11 +145,9 @@ static struct shortcut* get_shortcut(int index)
} while (handle_count > 0 && current_handle > 0);
if (handle_count > 0 && handle_index == 0)
{
- char buf[32];
- snprintf(buf, sizeof buf, "shortcuts_%d", index/SHORTCUTS_PER_HANDLE);
/* prevent invalidation of 'h' during compaction */
++buflib_move_lock;
- h->next_handle = core_alloc_ex(buf, sizeof(struct shortcut_handle), &shortcut_ops);
+ h->next_handle = core_alloc_ex(sizeof(struct shortcut_handle), &shortcut_ops);
--buflib_move_lock;
if (h->next_handle <= 0)
return NULL;
@@ -390,7 +387,7 @@ void shortcuts_init(void)
fd = open_utf8(SHORTCUTS_FILENAME, O_RDONLY);
if (fd < 0)
return;
- first_handle = core_alloc_ex("shortcuts_head", sizeof(struct shortcut_handle), &shortcut_ops);
+ first_handle = core_alloc_ex(sizeof(struct shortcut_handle), &shortcut_ops);
if (first_handle <= 0) {
close(fd);
return;
diff --git a/apps/tagcache.c b/apps/tagcache.c
index c853c9d5e8..69a6eaade5 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -410,7 +410,7 @@ static void allocate_tempbuf(void)
#else /* !__PCTOOL__ */
/* Need to pass dummy ops to prevent the buffer being moved
* out from under us, since we yield during the tagcache commit. */
- tempbuf_handle = core_alloc_maximum("tc tempbuf", &size, &buflib_ops_locked);
+ tempbuf_handle = core_alloc_maximum(&size, &buflib_ops_locked);
if (tempbuf_handle > 0)
{
tempbuf = core_get_data(tempbuf_handle);
@@ -4115,7 +4115,7 @@ static bool allocate_tagcache(void)
alloc_size += tcmh.tch.entry_count*sizeof(struct dircache_fileref);
#endif
- int handle = core_alloc_ex("tc ramcache", alloc_size, &ops);
+ int handle = core_alloc_ex(alloc_size, &ops);
if (handle <= 0)
return false;
@@ -4158,7 +4158,7 @@ static bool tagcache_dumpload(void)
}
/* Lets allocate real memory and load it */
- handle = core_alloc_ex("tc ramcache", shdr.tc_stat.ramcache_allocated, &ops);
+ handle = core_alloc_ex(shdr.tc_stat.ramcache_allocated, &ops);
if (handle <= 0)
{
logf("alloc failure");
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 03af5fc83a..10e63ae210 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -1255,7 +1255,7 @@ static bool initialize_tagtree(void) /* also used when user selects 'Reload' in
menu_count = 0;
menu = NULL;
rootmenu = -1;
- tagtree_handle = core_alloc_maximum("tagtree", &tagtree_bufsize, &ops);
+ tagtree_handle = core_alloc_maximum(&tagtree_bufsize, &ops);
if (tagtree_handle < 0)
panicf("tagtree OOM");
diff --git a/apps/talk.c b/apps/talk.c
index 65368e973f..2ef7fea84d 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -496,7 +496,7 @@ static bool load_index_table(int fd, const struct voicefile_header *hdr)
return true;
ssize_t alloc_size = (hdr->id1_max + hdr->id2_max) * sizeof(struct clip_entry);
- index_handle = core_alloc_ex("voice index", alloc_size, &talk_ops);
+ index_handle = core_alloc_ex(alloc_size, &talk_ops);
if (index_handle < 0)
return false;
@@ -536,7 +536,7 @@ static bool load_header(int fd, struct voicefile_header *hdr)
static bool create_clip_buffer(size_t max_size)
{
/* just allocate, populate on an as-needed basis later */
- talk_handle = core_alloc_ex("voice data", max_size, &talk_ops);
+ talk_handle = core_alloc_ex(max_size, &talk_ops);
if (talk_handle < 0)
goto alloc_err;
diff --git a/apps/tree.c b/apps/tree.c
index 22199710ae..d2a7111e5f 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -1063,14 +1063,11 @@ void tree_mem_init(void)
cache->name_buffer_size = AVERAGE_FILENAME_LENGTH *
global_settings.max_files_in_dir;
- cache->name_buffer_handle = core_alloc_ex("tree names",
- cache->name_buffer_size,
- &ops);
+ cache->name_buffer_handle = core_alloc_ex(cache->name_buffer_size, &ops);
cache->max_entries = global_settings.max_files_in_dir;
- cache->entries_handle = core_alloc_ex("tree entries",
- cache->max_entries*(sizeof(struct entry)),
- &ops);
+ cache->entries_handle =
+ core_alloc_ex(cache->max_entries*(sizeof(struct entry)), &ops);
}
bool bookmark_play(char *resume_file, int index, unsigned long elapsed,
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index 6ce0f6a408..dfc2dd8ed6 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -569,7 +569,7 @@ void voice_thread_init(void)
if (voice_thread_id != 0)
return; /* Already did an init and succeeded at it */
- voice_buf_hid = core_alloc_ex("voice buf", sizeof (*voice_buf), &ops);
+ voice_buf_hid = core_alloc_ex(sizeof (*voice_buf), &ops);
if (voice_buf_hid <= 0)
{
diff --git a/bootloader/x1000/boot.c b/bootloader/x1000/boot.c
index 9e22192516..8b44641604 100644
--- a/bootloader/x1000/boot.c
+++ b/bootloader/x1000/boot.c
@@ -72,7 +72,7 @@ static int read_linux_args(const char* filename)
int ret;
size_t max_size;
- int handle = core_alloc_maximum("args", &max_size, &buflib_ops_locked);
+ int handle = core_alloc_maximum(&max_size, &buflib_ops_locked);
if(handle <= 0) {
splashf(5*HZ, "Out of memory");
return -2;
diff --git a/bootloader/x1000/utils.c b/bootloader/x1000/utils.c
index a2fd500f5d..8d296b234b 100644
--- a/bootloader/x1000/utils.c
+++ b/bootloader/x1000/utils.c
@@ -103,7 +103,7 @@ int load_rockbox(const char* filename, size_t* sizep)
if(check_disk(true) != DISK_PRESENT)
return -1;
- int handle = core_alloc_maximum("rockbox", sizep, &buflib_ops_locked);
+ int handle = core_alloc_maximum(sizep, &buflib_ops_locked);
if(handle < 0) {
splashf(5*HZ, "Out of memory");
return -2;
diff --git a/firmware/buflib.c b/firmware/buflib.c
index ea57dbb379..8fc32f7406 100644
--- a/firmware/buflib.c
+++ b/firmware/buflib.c
@@ -633,7 +633,7 @@ buflib_buffer_in(struct buflib_context *ctx, int size)
int
buflib_alloc(struct buflib_context *ctx, size_t size)
{
- return buflib_alloc_ex(ctx, size, NULL, NULL);
+ return buflib_alloc_ex(ctx, size, NULL);
}
/* Allocate a buffer of size bytes, returning a handle for it.
@@ -647,11 +647,9 @@ buflib_alloc(struct buflib_context *ctx, size_t size)
*/
int
-buflib_alloc_ex(struct buflib_context *ctx, size_t size, const char *name,
+buflib_alloc_ex(struct buflib_context *ctx, size_t size,
struct buflib_callbacks *ops)
{
- (void)name;
-
union buflib_data *handle, *block;
bool last;
/* This really is assigned a value before use */
@@ -943,7 +941,7 @@ buflib_available(struct buflib_context* ctx)
* serviced anyway).
*/
int
-buflib_alloc_maximum(struct buflib_context* ctx, const char* name, size_t *size, struct buflib_callbacks *ops)
+buflib_alloc_maximum(struct buflib_context* ctx, size_t *size, struct buflib_callbacks *ops)
{
/* ignore ctx->compact because it's true if all movable blocks are contiguous
* even if the buffer has holes due to unmovable allocations */
@@ -960,7 +958,7 @@ buflib_alloc_maximum(struct buflib_context* ctx, const char* name, size_t *size,
if (*size <= 0) /* OOM */
return -1;
- return buflib_alloc_ex(ctx, *size, name, ops);
+ return buflib_alloc_ex(ctx, *size, ops);
}
/* Shrink the allocation indicated by the handle according to new_start and
@@ -1073,13 +1071,6 @@ unsigned buflib_pin_count(struct buflib_context *ctx, int handle)
return data[-bidx_PIN].pincount;
}
-const char* buflib_get_name(struct buflib_context *ctx, int handle)
-{
- (void)ctx;
- (void)handle;
- return "";
-}
-
#ifdef DEBUG
void *buflib_get_data(struct buflib_context *ctx, int handle)
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index 5902f8b3fd..41564194d0 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -479,7 +479,7 @@ static void binding_dissolve_volume(struct dircache_runinfo_volume *dcrivolp)
static int alloc_cache(size_t size)
{
/* pad with one extra-- see alloc_name() and free_name() */
- return core_alloc_ex("dircache", size + 1, &dircache_runinfo.ops);
+ return core_alloc_ex(size + 1, &dircache_runinfo.ops);
}
/**
diff --git a/firmware/common/unicode.c b/firmware/common/unicode.c
index e53ad6bcb0..1ed2e5e49d 100644
--- a/firmware/common/unicode.c
+++ b/firmware/common/unicode.c
@@ -166,15 +166,15 @@ static unsigned short default_cp_table_buf[MAX_CP_TABLE_SIZE+1];
default_cp_table_buf
#define cp_table_free(handle) \
do {} while (0)
-#define cp_table_alloc(filename, size, opsp) \
+#define cp_table_alloc(size, opsp) \
({ (void)(opsp); 1; })
#define cp_table_pin(handle) \
do { (void)handle; } while(0)
#define cp_table_unpin(handle) \
do { (void)handle; } while(0)
#else
-#define cp_table_alloc(filename, size, opsp) \
- core_alloc_ex((filename), (size), (opsp))
+#define cp_table_alloc(size, opsp) \
+ core_alloc_ex((size), (opsp))
#define cp_table_free(handle) \
core_free(handle)
#define cp_table_get_data(handle) \
@@ -223,7 +223,7 @@ static int alloc_and_load_cp_table(int cp, void *buf)
!(size % (off_t)sizeof (uint16_t))) {
/* if the buffer is provided, use that but don't alloc */
- int handle = buf ? 0 : cp_table_alloc(filename, size, NULL);
+ int handle = buf ? 0 : cp_table_alloc(size, NULL);
if (handle > 0) {
cp_table_pin(handle);
buf = cp_table_get_data(handle);
diff --git a/firmware/common/zip.c b/firmware/common/zip.c
index 6d250abb58..2d560e472e 100644
--- a/firmware/common/zip.c
+++ b/firmware/common/zip.c
@@ -31,7 +31,7 @@
#include "crc32.h"
#include "rbendian.h"
-#define zip_core_alloc(N) core_alloc_ex("zip",(N),&buflib_ops_locked)
+#define zip_core_alloc(N) core_alloc_ex((N),&buflib_ops_locked)
enum {
ZIP_SIG_ED = 0x06054b50,
diff --git a/firmware/core_alloc.c b/firmware/core_alloc.c
index 0374c801c1..f5cc7f3189 100644
--- a/firmware/core_alloc.c
+++ b/firmware/core_alloc.c
@@ -51,7 +51,7 @@ void core_allocator_init(void)
buflib_init(&core_ctx, start, audiobufend - start);
- test_alloc = core_alloc("test", 112);
+ test_alloc = core_alloc(112);
}
bool core_test_free(void)
@@ -69,14 +69,14 @@ bool core_test_free(void)
* Note: Buffers allocated by this functions are movable.
* Don't pass them to functions that call yield()
* like disc input/output. */
-int core_alloc(const char* name, size_t size)
+int core_alloc(size_t size)
{
- return buflib_alloc_ex(&core_ctx, size, name, NULL);
+ return buflib_alloc_ex(&core_ctx, size, NULL);
}
-int core_alloc_ex(const char* name, size_t size, struct buflib_callbacks *ops)
+int core_alloc_ex(size_t size, struct buflib_callbacks *ops)
{
- return buflib_alloc_ex(&core_ctx, size, name, ops);
+ return buflib_alloc_ex(&core_ctx, size, ops);
}
size_t core_available(void)
@@ -94,9 +94,9 @@ int core_free(int handle)
return buflib_free(&core_ctx, handle);
}
-int core_alloc_maximum(const char* name, size_t *size, struct buflib_callbacks *ops)
+int core_alloc_maximum(size_t *size, struct buflib_callbacks *ops)
{
- return buflib_alloc_maximum(&core_ctx, name, size, ops);
+ return buflib_alloc_maximum(&core_ctx, size, ops);
}
bool core_shrink(int handle, void* new_start, size_t new_size)
@@ -119,12 +119,6 @@ unsigned core_pin_count(int handle)
return buflib_pin_count(&core_ctx, handle);
}
-const char* core_get_name(int handle)
-{
- const char *name = buflib_get_name(&core_ctx, handle);
- return name ?: "<anonymous>";
-}
-
int core_get_num_blocks(void)
{
return buflib_get_num_blocks(&core_ctx);
diff --git a/firmware/font.c b/firmware/font.c
index 8f0808ba87..2a2975cbf2 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -525,7 +525,7 @@ int font_load_ex( const char *path, size_t buf_size, int glyphs )
font_id = open_slot;
/* allocate mem */
- int handle = core_alloc_ex( NULL,
+ int handle = core_alloc_ex(
bufsize + sizeof( struct buflib_alloc_data ),
&buflibops );
if ( handle <= 0 )
diff --git a/firmware/include/buflib.h b/firmware/include/buflib.h
index d2231ab79d..e54ec72a99 100644
--- a/firmware/include/buflib.h
+++ b/firmware/include/buflib.h
@@ -62,8 +62,7 @@ struct buflib_context
* to the actually requested number of bytes.
*
* The total number of bytes consumed by an allocation is
- * BUFLIB_ALLOC_OVERHEAD + requested bytes + strlen(<name passed to
- * buflib_alloc_ex()) + pad to pointer size
+ * BUFLIB_ALLOC_OVERHEAD + requested bytes + pad to pointer size
*/
#define BUFLIB_ALLOC_OVERHEAD (5*sizeof(union buflib_data))
@@ -215,7 +214,6 @@ int buflib_alloc(struct buflib_context *context, size_t size);
* Allocates memory from the buflib's memory pool with additional callbacks
* and flags
*
- * name: A string identifier giving this allocation a name
* size: How many bytes to allocate
* ops: a struct with pointers to callback functions (see above).
* if "ops" is NULL: Buffer is movable.
@@ -223,7 +221,7 @@ int buflib_alloc(struct buflib_context *context, size_t size);
* Returns: A positive integer handle identifying this allocation, or
* a negative value on error (0 is also not a valid handle)
*/
-int buflib_alloc_ex(struct buflib_context *ctx, size_t size, const char *name,
+int buflib_alloc_ex(struct buflib_context *ctx, size_t size,
struct buflib_callbacks *ops);
@@ -241,15 +239,14 @@ int buflib_alloc_ex(struct buflib_context *ctx, size_t size, const char *name,
* and even shrinks other allocations. However, do not depend on this behavior,
* it may change.
*
- * name: A string identifier giving this allocation a name
* size: The actual size will be returned into size
* ops: a struct with pointers to callback functions
*
* Returns: A positive integer handle identifying this allocation, or
* a negative value on error (0 is also not a valid handle)
*/
-int buflib_alloc_maximum(struct buflib_context* ctx, const char* name,
- size_t *size, struct buflib_callbacks *ops);
+int buflib_alloc_maximum(struct buflib_context* ctx,
+ size_t *size, struct buflib_callbacks *ops);
/**
* Queries the data pointer for the given handle. It's actually a cheap
@@ -349,18 +346,6 @@ void buflib_buffer_in(struct buflib_context *ctx, int size);
/* debugging */
/**
- * Returns the name, as given to buflib_alloc() and buflib_allloc_ex(), of the
- * allocation associated with the given handle. As naming allocations
- * is optional, there might be no name associated.
- *
- * handle: The handle indicating the allocation
- *
- * Returns: A pointer to the string identifier of the allocation, or NULL
- * if none was specified with buflib_alloc_ex().
- */
-const char* buflib_get_name(struct buflib_context *ctx, int handle);
-
-/**
* Gets the number of blocks in the entire buffer, allocated or unallocated
*
* Only available if BUFLIB_DEBUG_BLOCK_SIGNLE is defined
diff --git a/firmware/include/core_alloc.h b/firmware/include/core_alloc.h
index 13d8165be2..8011c227b1 100644
--- a/firmware/include/core_alloc.h
+++ b/firmware/include/core_alloc.h
@@ -11,9 +11,9 @@
* they have a predefined context
*/
void core_allocator_init(void) INIT_ATTR;
-int core_alloc(const char* name, size_t size);
-int core_alloc_ex(const char* name, size_t size, struct buflib_callbacks *ops);
-int core_alloc_maximum(const char* name, size_t *size, struct buflib_callbacks *ops);
+int core_alloc(size_t size);
+int core_alloc_ex(size_t size, struct buflib_callbacks *ops);
+int core_alloc_maximum(size_t *size, struct buflib_callbacks *ops);
bool core_shrink(int handle, void* new_start, size_t new_size);
void core_pin(int handle);
void core_unpin(int handle);
@@ -21,7 +21,6 @@ unsigned core_pin_count(int handle);
int core_free(int handle);
size_t core_available(void);
size_t core_allocatable(void);
-const char* core_get_name(int handle);
#ifdef DEBUG
void core_check_valid(void);
#endif
diff --git a/firmware/linuxboot.c b/firmware/linuxboot.c
index 419044b5a9..74d87fbd64 100644
--- a/firmware/linuxboot.c
+++ b/firmware/linuxboot.c
@@ -80,7 +80,7 @@ static int uimage_alloc_state(const struct uimage_header* uh)
#ifdef HAVE_UIMAGE_COMP_GZIP
case IH_COMP_GZIP:
size = inflate_size + inflate_align - 1;
- return core_alloc_ex("inflate", size, &buflib_ops_locked);
+ return core_alloc_ex(size, &buflib_ops_locked);
#endif
default:
@@ -206,7 +206,7 @@ int uimage_load(struct uimage_header* uh, size_t* out_size,
return E_OUT_OF_MEMORY;
*out_size = 0;
- int out_h = core_alloc_maximum("uimage", out_size, &buflib_ops_locked);
+ int out_h = core_alloc_maximum(out_size, &buflib_ops_locked);
if(out_h <= 0) {
ret = E_OUT_OF_MEMORY;
goto err;
diff --git a/firmware/rolo.c b/firmware/rolo.c
index d280e39243..a3e6d5c2b9 100644
--- a/firmware/rolo.c
+++ b/firmware/rolo.c
@@ -239,7 +239,7 @@ int rolo_load(const char* filename)
/* get the system buffer. release only in case of error, otherwise
* we don't return anyway */
- rolo_handle = core_alloc_maximum("rolo", &filebuf_size, &buflib_ops_locked);
+ rolo_handle = core_alloc_maximum(&filebuf_size, &buflib_ops_locked);
if (rolo_handle < 0)
{
rolo_error("OOM");
diff --git a/firmware/target/arm/ata-nand-telechips.c b/firmware/target/arm/ata-nand-telechips.c
index 55f6b1f3f7..d61c223219 100644
--- a/firmware/target/arm/ata-nand-telechips.c
+++ b/firmware/target/arm/ata-nand-telechips.c
@@ -915,7 +915,7 @@ int nand_init(void)
#ifndef BOOTLOADER
/* Use chip info to allocate the correct size LPT buffer */
lptbuf_size = sizeof(struct lpt_entry) * segments_per_bank * total_banks;
- lpt_handle = core_alloc("lpt lookup", lptbuf_size);
+ lpt_handle = core_alloc(lptbuf_size);
struct lpt_entry* lpt_lookup = core_get_data(lpt_handle);
#else
/* Use a static array in the bootloader */
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
index f13904628d..a1985472a0 100644
--- a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
+++ b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
@@ -303,7 +303,7 @@ static void cfs_init(void)
_ata_read_sectors(CFS_CLUSTER2CLUSTER(vfat_inodes_nr[1]), 1, &sector);
inode = (struct cfs_inode*)&sector;
#ifndef BOOTLOADER
- sectors_handle = core_alloc("ata sectors", VFAT_SECTOR_SIZE(inode->filesize));
+ sectors_handle = core_alloc(VFAT_SECTOR_SIZE(inode->filesize));
unsigned long *sectors = core_get_data(sectors_handle);
#else
static unsigned long _sector[VFAT_SECTOR_SIZE(1024*1024*1024)]; /* 1GB guess */
diff --git a/firmware/target/mips/ingenic_x1000/installer-x1000.c b/firmware/target/mips/ingenic_x1000/installer-x1000.c
index acc1d7b711..d2f9e4e5e0 100644
--- a/firmware/target/mips/ingenic_x1000/installer-x1000.c
+++ b/firmware/target/mips/ingenic_x1000/installer-x1000.c
@@ -151,7 +151,7 @@ static int updater_init(struct updater* u)
/* buf_len is a bit oversized here, but it's not really important */
u->buf_len = u->img_len + sizeof(mtar_t) + 2*CACHEALIGN_SIZE;
- u->buf_hnd = core_alloc_ex("boot_image", u->buf_len, &buflib_ops_locked);
+ u->buf_hnd = core_alloc_ex(u->buf_len, &buflib_ops_locked);
if(u->buf_hnd < 0) {
rc = IERR_OUT_OF_MEMORY;
goto error;
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index 08b1f0b7e7..714af9d535 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -451,8 +451,7 @@ void usb_storage_init_connection(void)
unsigned char * buffer;
// Add 31 to handle worst-case misalignment
- usb_handle = core_alloc_ex("usb storage",
- ALLOCATE_BUFFER_SIZE + MAX_CBW_SIZE + 31,
+ usb_handle = core_alloc_ex(ALLOCATE_BUFFER_SIZE + MAX_CBW_SIZE + 31,
&buflib_ops_locked);
if (usb_handle < 0)
panicf("%s(): OOM", __func__);
diff --git a/lib/rbcodec/dsp/pbe.c b/lib/rbcodec/dsp/pbe.c
index 634849d91c..ca4e30ba0f 100644
--- a/lib/rbcodec/dsp/pbe.c
+++ b/lib/rbcodec/dsp/pbe.c
@@ -49,7 +49,7 @@ static int handle = -1;
static int pbe_buffer_alloc(void)
{
- handle = core_alloc("dsp_pbe_buffer", PBE_BUFSIZE);
+ handle = core_alloc(PBE_BUFSIZE);
return handle;
}
diff --git a/lib/rbcodec/dsp/surround.c b/lib/rbcodec/dsp/surround.c
index 9a1f7be8b6..c0dce33a47 100644
--- a/lib/rbcodec/dsp/surround.c
+++ b/lib/rbcodec/dsp/surround.c
@@ -66,7 +66,7 @@ static int handle = -1;
static int surround_buffer_alloc(void)
{
- handle = core_alloc("dsp_surround_buffer", SURROUND_BUFSIZE);
+ handle = core_alloc(SURROUND_BUFSIZE);
return handle;
}