Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove buflib allocation names, part two

Remove allocation names from the buflib API and fix up all callers.

Change-Id: I3df922e258d5f0d711d70e72b56b4ed634fb0f5a

+69 -115
+1 -1
apps/action.c
··· 1202 1202 return action_set_keymap_handle(0, 0); 1203 1203 1204 1204 size_t keyremap_buf_size = count * sizeof(struct button_mapping); 1205 - int handle = core_alloc("keyremap", keyremap_buf_size); 1205 + int handle = core_alloc(keyremap_buf_size); 1206 1206 if (handle < 0) 1207 1207 return -6; 1208 1208
+1 -1
apps/core_keymap.c
··· 77 77 return -1; 78 78 79 79 size_t bufsize = count * sizeof(struct button_mapping); 80 - int handle = core_alloc("keyremap", bufsize); 80 + int handle = core_alloc(bufsize); 81 81 if (handle > 0) 82 82 { 83 83 core_pin(handle);
+1 -1
apps/debug_menu.c
··· 515 515 else 516 516 { 517 517 splash(HZ/1, "Attempting a 64k allocation"); 518 - int handle = core_alloc("test", 64<<10); 518 + int handle = core_alloc(64<<10); 519 519 splash(HZ/2, (handle > 0) ? "Success":"Fail"); 520 520 /* for some reason simplelist doesn't allow adding items here if 521 521 * info.get_name is given, so use normal list api */
+1 -1
apps/filetypes.c
··· 409 409 410 410 /* estimate bufsize with the filesize, will not be larger */ 411 411 strdup_bufsize = (size_t)filesz; 412 - strdup_handle = core_alloc_ex("filetypes", strdup_bufsize, &ops); 412 + strdup_handle = core_alloc_ex(strdup_bufsize, &ops); 413 413 if(strdup_handle <= 0) 414 414 goto out; 415 415
+2 -3
apps/gui/skin_engine/skin_backdrops.c
··· 174 174 } 175 175 if (*filename && *filename != '-') 176 176 { 177 - backdrops[i].buflib_handle = core_alloc_ex(filename, buf_size, &buflib_ops); 177 + backdrops[i].buflib_handle = core_alloc_ex(buf_size, &buflib_ops); 178 178 if (backdrops[i].buflib_handle > 0) 179 179 { 180 180 backdrops[i].buffer = core_get_data(backdrops[i].buflib_handle); ··· 287 287 if (backdrops[i].buflib_handle <= 0) 288 288 { 289 289 backdrops[i].buflib_handle = 290 - core_alloc_ex(global_settings.backdrop_file, 291 - LCD_BACKDROP_BYTES, &buflib_ops); 290 + core_alloc_ex(LCD_BACKDROP_BYTES, &buflib_ops); 292 291 if (backdrops[i].buflib_handle <= 0) 293 292 return; 294 293 }
+1 -2
apps/gui/skin_engine/skin_parser.c
··· 2574 2574 } 2575 2575 #endif 2576 2576 #ifndef __PCTOOL__ 2577 - wps_data->buflib_handle = core_alloc(isfile ? buf : "failsafe skin", 2578 - skin_buffer_usage()); 2577 + wps_data->buflib_handle = core_alloc(skin_buffer_usage()); 2579 2578 if (wps_data->buflib_handle > 0) 2580 2579 { 2581 2580 wps_data->wps_loaded = true;
+1 -1
apps/iap/iap-core.c
··· 453 453 return; 454 454 455 455 #ifdef IAP_MALLOC_DYNAMIC 456 - iap_buffer_handle = core_alloc_ex("iap", IAP_MALLOC_SIZE, &iap_buflib_callbacks); 456 + iap_buffer_handle = core_alloc_ex(IAP_MALLOC_SIZE, &iap_buflib_callbacks); 457 457 if (iap_buffer_handle < 0) 458 458 panicf("Could not allocate buffer memory"); 459 459 iap_buffers = core_get_data(iap_buffer_handle);
+1 -3
apps/misc.c
··· 1606 1606 1607 1607 if (buf_size > 0) 1608 1608 { 1609 - 1610 - handle = core_alloc_ex(filename, (size_t) buf_size, ops); 1611 - 1609 + handle = core_alloc_ex(buf_size, ops); 1612 1610 if (handle > 0) 1613 1611 { 1614 1612 core_pin(handle);
+1 -1
apps/playback.c
··· 997 997 } 998 998 if (core_allocatable() < (1 << 10)) 999 999 talk_buffer_set_policy(TALK_BUFFER_LOOSE); /* back off voice buffer */ 1000 - audiobuf_handle = core_alloc_maximum("audiobuf", &filebuflen, &ops); 1000 + audiobuf_handle = core_alloc_maximum(&filebuflen, &ops); 1001 1001 1002 1002 if (audiobuf_handle > 0) 1003 1003 audio_reset_buffer_noalloc(core_get_data(audiobuf_handle));
+4 -5
apps/playlist.c
··· 2020 2020 static int alloc_tempbuf(size_t* buflen) 2021 2021 { 2022 2022 /* request a reasonable size first */ 2023 - int handle = core_alloc_ex(NULL, PLAYLIST_LOAD_BUFLEN, &buflib_ops_locked); 2023 + int handle = core_alloc_ex(PLAYLIST_LOAD_BUFLEN, &buflib_ops_locked); 2024 2024 if (handle > 0) 2025 2025 { 2026 2026 *buflen = PLAYLIST_LOAD_BUFLEN; ··· 2028 2028 } 2029 2029 2030 2030 /* otherwise, try being unreasonable */ 2031 - return core_alloc_maximum(NULL, buflen, &buflib_ops_locked); 2031 + return core_alloc_maximum(buflen, &buflib_ops_locked); 2032 2032 } 2033 2033 2034 2034 /* ··· 2075 2075 playlist->fd = -1; 2076 2076 playlist->control_fd = -1; 2077 2077 playlist->max_playlist_size = global_settings.max_files_in_playlist; 2078 - handle = core_alloc_ex("playlist idx", 2079 - playlist->max_playlist_size * sizeof(*playlist->indices), &ops); 2080 2078 2079 + handle = core_alloc_ex(playlist->max_playlist_size * sizeof(*playlist->indices), &ops); 2081 2080 playlist->indices = core_get_data(handle); 2082 2081 2083 2082 initalize_new_playlist(playlist, true); 2084 2083 2085 2084 #ifdef HAVE_DIRCACHE 2086 - handle = core_alloc_ex("playlist dc", 2085 + handle = core_alloc_ex( 2087 2086 playlist->max_playlist_size * sizeof(*playlist->dcfrefs), &ops); 2088 2087 playlist->dcfrefs = core_get_data(handle); 2089 2088 dc_copy_filerefs(playlist->dcfrefs, NULL, playlist->max_playlist_size);
+1 -3
apps/plugin.c
··· 585 585 buflib_free, 586 586 buflib_shrink, 587 587 buflib_get_data, 588 - buflib_get_name, 589 588 590 589 /* sound */ 591 590 sound_set, ··· 1039 1038 { 1040 1039 if (plugin_buffer_handle <= 0) 1041 1040 { 1042 - plugin_buffer_handle = core_alloc_maximum("plugin audio buf", 1043 - &plugin_buffer_size, 1041 + plugin_buffer_handle = core_alloc_maximum(&plugin_buffer_size, 1044 1042 &buflib_ops_locked); 1045 1043 } 1046 1044
+2 -3
apps/plugin.h
··· 649 649 size_t (*buflib_available)(struct buflib_context* ctx); 650 650 int (*buflib_alloc)(struct buflib_context* ctx, size_t size); 651 651 int (*buflib_alloc_ex)(struct buflib_context* ctx, size_t size, 652 - const char* name, struct buflib_callbacks *ops); 653 - int (*buflib_alloc_maximum)(struct buflib_context* ctx, const char* name, 652 + struct buflib_callbacks *ops); 653 + int (*buflib_alloc_maximum)(struct buflib_context* ctx, 654 654 size_t* size, struct buflib_callbacks *ops); 655 655 void (*buflib_buffer_in)(struct buflib_context* ctx, int size); 656 656 void* (*buflib_buffer_out)(struct buflib_context* ctx, size_t* size); ··· 658 658 bool (*buflib_shrink)(struct buflib_context* ctx, int handle, 659 659 void* new_start, size_t new_size); 660 660 void* (*buflib_get_data)(struct buflib_context* ctx, int handle); 661 - const char* (*buflib_get_name)(struct buflib_context* ctx, int handle); 662 661 663 662 /* sound */ 664 663 void (*sound_set)(int setting, int value);
+1 -1
apps/radio/radioart.c
··· 202 202 { 203 203 /* grab control over buffering */ 204 204 size_t bufsize; 205 - int handle = core_alloc_maximum("radioart", &bufsize, &radioart_ops); 205 + int handle = core_alloc_maximum(&bufsize, &radioart_ops); 206 206 if (handle <0) 207 207 { 208 208 splash(HZ, "Radioart Failed - OOM");
+1 -1
apps/rbcodec_helpers.c
··· 64 64 { 65 65 if (handles[i] <= 0) 66 66 { 67 - handles[i] = core_alloc_ex("tdspeed", buf_s[i], &ops); 67 + handles[i] = core_alloc_ex(buf_s[i], &ops); 68 68 69 69 if (handles[i] <= 0) 70 70 return false;
+1 -1
apps/recorder/pcm_record.c
··· 1408 1408 send_event(RECORDING_EVENT_START, NULL); 1409 1409 /* FIXME: This buffer should play nicer and be shrinkable/movable */ 1410 1410 talk_buffer_set_policy(TALK_BUFFER_LOOSE); 1411 - pcmrec_handle = core_alloc_maximum("pcmrec", &rec_buffer_size, &buflib_ops_locked); 1411 + pcmrec_handle = core_alloc_maximum(&rec_buffer_size, &buflib_ops_locked); 1412 1412 if (pcmrec_handle <= 0) 1413 1413 /* someone is abusing core_alloc_maximum(). Fix this evil guy instead of 1414 1414 * trying to handle OOM without hope */
+3 -6
apps/shortcuts.c
··· 128 128 129 129 if (first_handle == 0) 130 130 { 131 - first_handle = core_alloc_ex("shortcuts_head", 132 - sizeof(struct shortcut_handle), &shortcut_ops); 131 + first_handle = core_alloc_ex(sizeof(struct shortcut_handle), &shortcut_ops); 133 132 if (first_handle <= 0) 134 133 return NULL; 135 134 h = core_get_data(first_handle); ··· 146 145 } while (handle_count > 0 && current_handle > 0); 147 146 if (handle_count > 0 && handle_index == 0) 148 147 { 149 - char buf[32]; 150 - snprintf(buf, sizeof buf, "shortcuts_%d", index/SHORTCUTS_PER_HANDLE); 151 148 /* prevent invalidation of 'h' during compaction */ 152 149 ++buflib_move_lock; 153 - h->next_handle = core_alloc_ex(buf, sizeof(struct shortcut_handle), &shortcut_ops); 150 + h->next_handle = core_alloc_ex(sizeof(struct shortcut_handle), &shortcut_ops); 154 151 --buflib_move_lock; 155 152 if (h->next_handle <= 0) 156 153 return NULL; ··· 390 387 fd = open_utf8(SHORTCUTS_FILENAME, O_RDONLY); 391 388 if (fd < 0) 392 389 return; 393 - first_handle = core_alloc_ex("shortcuts_head", sizeof(struct shortcut_handle), &shortcut_ops); 390 + first_handle = core_alloc_ex(sizeof(struct shortcut_handle), &shortcut_ops); 394 391 if (first_handle <= 0) { 395 392 close(fd); 396 393 return;
+3 -3
apps/tagcache.c
··· 410 410 #else /* !__PCTOOL__ */ 411 411 /* Need to pass dummy ops to prevent the buffer being moved 412 412 * out from under us, since we yield during the tagcache commit. */ 413 - tempbuf_handle = core_alloc_maximum("tc tempbuf", &size, &buflib_ops_locked); 413 + tempbuf_handle = core_alloc_maximum(&size, &buflib_ops_locked); 414 414 if (tempbuf_handle > 0) 415 415 { 416 416 tempbuf = core_get_data(tempbuf_handle); ··· 4115 4115 alloc_size += tcmh.tch.entry_count*sizeof(struct dircache_fileref); 4116 4116 #endif 4117 4117 4118 - int handle = core_alloc_ex("tc ramcache", alloc_size, &ops); 4118 + int handle = core_alloc_ex(alloc_size, &ops); 4119 4119 if (handle <= 0) 4120 4120 return false; 4121 4121 ··· 4158 4158 } 4159 4159 4160 4160 /* Lets allocate real memory and load it */ 4161 - handle = core_alloc_ex("tc ramcache", shdr.tc_stat.ramcache_allocated, &ops); 4161 + handle = core_alloc_ex(shdr.tc_stat.ramcache_allocated, &ops); 4162 4162 if (handle <= 0) 4163 4163 { 4164 4164 logf("alloc failure");
+1 -1
apps/tagtree.c
··· 1255 1255 menu_count = 0; 1256 1256 menu = NULL; 1257 1257 rootmenu = -1; 1258 - tagtree_handle = core_alloc_maximum("tagtree", &tagtree_bufsize, &ops); 1258 + tagtree_handle = core_alloc_maximum(&tagtree_bufsize, &ops); 1259 1259 if (tagtree_handle < 0) 1260 1260 panicf("tagtree OOM"); 1261 1261
+2 -2
apps/talk.c
··· 496 496 return true; 497 497 498 498 ssize_t alloc_size = (hdr->id1_max + hdr->id2_max) * sizeof(struct clip_entry); 499 - index_handle = core_alloc_ex("voice index", alloc_size, &talk_ops); 499 + index_handle = core_alloc_ex(alloc_size, &talk_ops); 500 500 if (index_handle < 0) 501 501 return false; 502 502 ··· 536 536 static bool create_clip_buffer(size_t max_size) 537 537 { 538 538 /* just allocate, populate on an as-needed basis later */ 539 - talk_handle = core_alloc_ex("voice data", max_size, &talk_ops); 539 + talk_handle = core_alloc_ex(max_size, &talk_ops); 540 540 if (talk_handle < 0) 541 541 goto alloc_err; 542 542
+3 -6
apps/tree.c
··· 1063 1063 1064 1064 cache->name_buffer_size = AVERAGE_FILENAME_LENGTH * 1065 1065 global_settings.max_files_in_dir; 1066 - cache->name_buffer_handle = core_alloc_ex("tree names", 1067 - cache->name_buffer_size, 1068 - &ops); 1066 + cache->name_buffer_handle = core_alloc_ex(cache->name_buffer_size, &ops); 1069 1067 1070 1068 cache->max_entries = global_settings.max_files_in_dir; 1071 - cache->entries_handle = core_alloc_ex("tree entries", 1072 - cache->max_entries*(sizeof(struct entry)), 1073 - &ops); 1069 + cache->entries_handle = 1070 + core_alloc_ex(cache->max_entries*(sizeof(struct entry)), &ops); 1074 1071 } 1075 1072 1076 1073 bool bookmark_play(char *resume_file, int index, unsigned long elapsed,
+1 -1
apps/voice_thread.c
··· 569 569 if (voice_thread_id != 0) 570 570 return; /* Already did an init and succeeded at it */ 571 571 572 - voice_buf_hid = core_alloc_ex("voice buf", sizeof (*voice_buf), &ops); 572 + voice_buf_hid = core_alloc_ex(sizeof (*voice_buf), &ops); 573 573 574 574 if (voice_buf_hid <= 0) 575 575 {
+1 -1
bootloader/x1000/boot.c
··· 72 72 int ret; 73 73 74 74 size_t max_size; 75 - int handle = core_alloc_maximum("args", &max_size, &buflib_ops_locked); 75 + int handle = core_alloc_maximum(&max_size, &buflib_ops_locked); 76 76 if(handle <= 0) { 77 77 splashf(5*HZ, "Out of memory"); 78 78 return -2;
+1 -1
bootloader/x1000/utils.c
··· 103 103 if(check_disk(true) != DISK_PRESENT) 104 104 return -1; 105 105 106 - int handle = core_alloc_maximum("rockbox", sizep, &buflib_ops_locked); 106 + int handle = core_alloc_maximum(sizep, &buflib_ops_locked); 107 107 if(handle < 0) { 108 108 splashf(5*HZ, "Out of memory"); 109 109 return -2;
+4 -13
firmware/buflib.c
··· 633 633 int 634 634 buflib_alloc(struct buflib_context *ctx, size_t size) 635 635 { 636 - return buflib_alloc_ex(ctx, size, NULL, NULL); 636 + return buflib_alloc_ex(ctx, size, NULL); 637 637 } 638 638 639 639 /* Allocate a buffer of size bytes, returning a handle for it. ··· 647 647 */ 648 648 649 649 int 650 - buflib_alloc_ex(struct buflib_context *ctx, size_t size, const char *name, 650 + buflib_alloc_ex(struct buflib_context *ctx, size_t size, 651 651 struct buflib_callbacks *ops) 652 652 { 653 - (void)name; 654 - 655 653 union buflib_data *handle, *block; 656 654 bool last; 657 655 /* This really is assigned a value before use */ ··· 943 941 * serviced anyway). 944 942 */ 945 943 int 946 - buflib_alloc_maximum(struct buflib_context* ctx, const char* name, size_t *size, struct buflib_callbacks *ops) 944 + buflib_alloc_maximum(struct buflib_context* ctx, size_t *size, struct buflib_callbacks *ops) 947 945 { 948 946 /* ignore ctx->compact because it's true if all movable blocks are contiguous 949 947 * even if the buffer has holes due to unmovable allocations */ ··· 960 958 if (*size <= 0) /* OOM */ 961 959 return -1; 962 960 963 - return buflib_alloc_ex(ctx, *size, name, ops); 961 + return buflib_alloc_ex(ctx, *size, ops); 964 962 } 965 963 966 964 /* Shrink the allocation indicated by the handle according to new_start and ··· 1071 1069 1072 1070 union buflib_data *data = handle_to_block_end(ctx, handle); 1073 1071 return data[-bidx_PIN].pincount; 1074 - } 1075 - 1076 - const char* buflib_get_name(struct buflib_context *ctx, int handle) 1077 - { 1078 - (void)ctx; 1079 - (void)handle; 1080 - return ""; 1081 1072 } 1082 1073 1083 1074 #ifdef DEBUG
+1 -1
firmware/common/dircache.c
··· 479 479 static int alloc_cache(size_t size) 480 480 { 481 481 /* pad with one extra-- see alloc_name() and free_name() */ 482 - return core_alloc_ex("dircache", size + 1, &dircache_runinfo.ops); 482 + return core_alloc_ex(size + 1, &dircache_runinfo.ops); 483 483 } 484 484 485 485 /**
+4 -4
firmware/common/unicode.c
··· 166 166 default_cp_table_buf 167 167 #define cp_table_free(handle) \ 168 168 do {} while (0) 169 - #define cp_table_alloc(filename, size, opsp) \ 169 + #define cp_table_alloc(size, opsp) \ 170 170 ({ (void)(opsp); 1; }) 171 171 #define cp_table_pin(handle) \ 172 172 do { (void)handle; } while(0) 173 173 #define cp_table_unpin(handle) \ 174 174 do { (void)handle; } while(0) 175 175 #else 176 - #define cp_table_alloc(filename, size, opsp) \ 177 - core_alloc_ex((filename), (size), (opsp)) 176 + #define cp_table_alloc(size, opsp) \ 177 + core_alloc_ex((size), (opsp)) 178 178 #define cp_table_free(handle) \ 179 179 core_free(handle) 180 180 #define cp_table_get_data(handle) \ ··· 223 223 !(size % (off_t)sizeof (uint16_t))) { 224 224 225 225 /* if the buffer is provided, use that but don't alloc */ 226 - int handle = buf ? 0 : cp_table_alloc(filename, size, NULL); 226 + int handle = buf ? 0 : cp_table_alloc(size, NULL); 227 227 if (handle > 0) { 228 228 cp_table_pin(handle); 229 229 buf = cp_table_get_data(handle);
+1 -1
firmware/common/zip.c
··· 31 31 #include "crc32.h" 32 32 #include "rbendian.h" 33 33 34 - #define zip_core_alloc(N) core_alloc_ex("zip",(N),&buflib_ops_locked) 34 + #define zip_core_alloc(N) core_alloc_ex((N),&buflib_ops_locked) 35 35 36 36 enum { 37 37 ZIP_SIG_ED = 0x06054b50,
+7 -13
firmware/core_alloc.c
··· 51 51 52 52 buflib_init(&core_ctx, start, audiobufend - start); 53 53 54 - test_alloc = core_alloc("test", 112); 54 + test_alloc = core_alloc(112); 55 55 } 56 56 57 57 bool core_test_free(void) ··· 69 69 * Note: Buffers allocated by this functions are movable. 70 70 * Don't pass them to functions that call yield() 71 71 * like disc input/output. */ 72 - int core_alloc(const char* name, size_t size) 72 + int core_alloc(size_t size) 73 73 { 74 - return buflib_alloc_ex(&core_ctx, size, name, NULL); 74 + return buflib_alloc_ex(&core_ctx, size, NULL); 75 75 } 76 76 77 - int core_alloc_ex(const char* name, size_t size, struct buflib_callbacks *ops) 77 + int core_alloc_ex(size_t size, struct buflib_callbacks *ops) 78 78 { 79 - return buflib_alloc_ex(&core_ctx, size, name, ops); 79 + return buflib_alloc_ex(&core_ctx, size, ops); 80 80 } 81 81 82 82 size_t core_available(void) ··· 94 94 return buflib_free(&core_ctx, handle); 95 95 } 96 96 97 - int core_alloc_maximum(const char* name, size_t *size, struct buflib_callbacks *ops) 97 + int core_alloc_maximum(size_t *size, struct buflib_callbacks *ops) 98 98 { 99 - return buflib_alloc_maximum(&core_ctx, name, size, ops); 99 + return buflib_alloc_maximum(&core_ctx, size, ops); 100 100 } 101 101 102 102 bool core_shrink(int handle, void* new_start, size_t new_size) ··· 117 117 unsigned core_pin_count(int handle) 118 118 { 119 119 return buflib_pin_count(&core_ctx, handle); 120 - } 121 - 122 - const char* core_get_name(int handle) 123 - { 124 - const char *name = buflib_get_name(&core_ctx, handle); 125 - return name ?: "<anonymous>"; 126 120 } 127 121 128 122 int core_get_num_blocks(void)
+1 -1
firmware/font.c
··· 525 525 font_id = open_slot; 526 526 527 527 /* allocate mem */ 528 - int handle = core_alloc_ex( NULL, 528 + int handle = core_alloc_ex( 529 529 bufsize + sizeof( struct buflib_alloc_data ), 530 530 &buflibops ); 531 531 if ( handle <= 0 )
+4 -19
firmware/include/buflib.h
··· 62 62 * to the actually requested number of bytes. 63 63 * 64 64 * The total number of bytes consumed by an allocation is 65 - * BUFLIB_ALLOC_OVERHEAD + requested bytes + strlen(<name passed to 66 - * buflib_alloc_ex()) + pad to pointer size 65 + * BUFLIB_ALLOC_OVERHEAD + requested bytes + pad to pointer size 67 66 */ 68 67 #define BUFLIB_ALLOC_OVERHEAD (5*sizeof(union buflib_data)) 69 68 ··· 215 214 * Allocates memory from the buflib's memory pool with additional callbacks 216 215 * and flags 217 216 * 218 - * name: A string identifier giving this allocation a name 219 217 * size: How many bytes to allocate 220 218 * ops: a struct with pointers to callback functions (see above). 221 219 * if "ops" is NULL: Buffer is movable. ··· 223 221 * Returns: A positive integer handle identifying this allocation, or 224 222 * a negative value on error (0 is also not a valid handle) 225 223 */ 226 - int buflib_alloc_ex(struct buflib_context *ctx, size_t size, const char *name, 224 + int buflib_alloc_ex(struct buflib_context *ctx, size_t size, 227 225 struct buflib_callbacks *ops); 228 226 229 227 ··· 241 239 * and even shrinks other allocations. However, do not depend on this behavior, 242 240 * it may change. 243 241 * 244 - * name: A string identifier giving this allocation a name 245 242 * size: The actual size will be returned into size 246 243 * ops: a struct with pointers to callback functions 247 244 * 248 245 * Returns: A positive integer handle identifying this allocation, or 249 246 * a negative value on error (0 is also not a valid handle) 250 247 */ 251 - int buflib_alloc_maximum(struct buflib_context* ctx, const char* name, 252 - size_t *size, struct buflib_callbacks *ops); 248 + int buflib_alloc_maximum(struct buflib_context* ctx, 249 + size_t *size, struct buflib_callbacks *ops); 253 250 254 251 /** 255 252 * Queries the data pointer for the given handle. It's actually a cheap ··· 347 344 void buflib_buffer_in(struct buflib_context *ctx, int size); 348 345 349 346 /* debugging */ 350 - 351 - /** 352 - * Returns the name, as given to buflib_alloc() and buflib_allloc_ex(), of the 353 - * allocation associated with the given handle. As naming allocations 354 - * is optional, there might be no name associated. 355 - * 356 - * handle: The handle indicating the allocation 357 - * 358 - * Returns: A pointer to the string identifier of the allocation, or NULL 359 - * if none was specified with buflib_alloc_ex(). 360 - */ 361 - const char* buflib_get_name(struct buflib_context *ctx, int handle); 362 347 363 348 /** 364 349 * Gets the number of blocks in the entire buffer, allocated or unallocated
+3 -4
firmware/include/core_alloc.h
··· 11 11 * they have a predefined context 12 12 */ 13 13 void core_allocator_init(void) INIT_ATTR; 14 - int core_alloc(const char* name, size_t size); 15 - int core_alloc_ex(const char* name, size_t size, struct buflib_callbacks *ops); 16 - int core_alloc_maximum(const char* name, size_t *size, struct buflib_callbacks *ops); 14 + int core_alloc(size_t size); 15 + int core_alloc_ex(size_t size, struct buflib_callbacks *ops); 16 + int core_alloc_maximum(size_t *size, struct buflib_callbacks *ops); 17 17 bool core_shrink(int handle, void* new_start, size_t new_size); 18 18 void core_pin(int handle); 19 19 void core_unpin(int handle); ··· 21 21 int core_free(int handle); 22 22 size_t core_available(void); 23 23 size_t core_allocatable(void); 24 - const char* core_get_name(int handle); 25 24 #ifdef DEBUG 26 25 void core_check_valid(void); 27 26 #endif
+2 -2
firmware/linuxboot.c
··· 80 80 #ifdef HAVE_UIMAGE_COMP_GZIP 81 81 case IH_COMP_GZIP: 82 82 size = inflate_size + inflate_align - 1; 83 - return core_alloc_ex("inflate", size, &buflib_ops_locked); 83 + return core_alloc_ex(size, &buflib_ops_locked); 84 84 #endif 85 85 86 86 default: ··· 206 206 return E_OUT_OF_MEMORY; 207 207 208 208 *out_size = 0; 209 - int out_h = core_alloc_maximum("uimage", out_size, &buflib_ops_locked); 209 + int out_h = core_alloc_maximum(out_size, &buflib_ops_locked); 210 210 if(out_h <= 0) { 211 211 ret = E_OUT_OF_MEMORY; 212 212 goto err;
+1 -1
firmware/rolo.c
··· 239 239 240 240 /* get the system buffer. release only in case of error, otherwise 241 241 * we don't return anyway */ 242 - rolo_handle = core_alloc_maximum("rolo", &filebuf_size, &buflib_ops_locked); 242 + rolo_handle = core_alloc_maximum(&filebuf_size, &buflib_ops_locked); 243 243 if (rolo_handle < 0) 244 244 { 245 245 rolo_error("OOM");
+1 -1
firmware/target/arm/ata-nand-telechips.c
··· 915 915 #ifndef BOOTLOADER 916 916 /* Use chip info to allocate the correct size LPT buffer */ 917 917 lptbuf_size = sizeof(struct lpt_entry) * segments_per_bank * total_banks; 918 - lpt_handle = core_alloc("lpt lookup", lptbuf_size); 918 + lpt_handle = core_alloc(lptbuf_size); 919 919 struct lpt_entry* lpt_lookup = core_get_data(lpt_handle); 920 920 #else 921 921 /* Use a static array in the bootloader */
+1 -1
firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
··· 303 303 _ata_read_sectors(CFS_CLUSTER2CLUSTER(vfat_inodes_nr[1]), 1, &sector); 304 304 inode = (struct cfs_inode*)&sector; 305 305 #ifndef BOOTLOADER 306 - sectors_handle = core_alloc("ata sectors", VFAT_SECTOR_SIZE(inode->filesize)); 306 + sectors_handle = core_alloc(VFAT_SECTOR_SIZE(inode->filesize)); 307 307 unsigned long *sectors = core_get_data(sectors_handle); 308 308 #else 309 309 static unsigned long _sector[VFAT_SECTOR_SIZE(1024*1024*1024)]; /* 1GB guess */
+1 -1
firmware/target/mips/ingenic_x1000/installer-x1000.c
··· 151 151 152 152 /* buf_len is a bit oversized here, but it's not really important */ 153 153 u->buf_len = u->img_len + sizeof(mtar_t) + 2*CACHEALIGN_SIZE; 154 - u->buf_hnd = core_alloc_ex("boot_image", u->buf_len, &buflib_ops_locked); 154 + u->buf_hnd = core_alloc_ex(u->buf_len, &buflib_ops_locked); 155 155 if(u->buf_hnd < 0) { 156 156 rc = IERR_OUT_OF_MEMORY; 157 157 goto error;
+1 -2
firmware/usbstack/usb_storage.c
··· 451 451 unsigned char * buffer; 452 452 453 453 // Add 31 to handle worst-case misalignment 454 - usb_handle = core_alloc_ex("usb storage", 455 - ALLOCATE_BUFFER_SIZE + MAX_CBW_SIZE + 31, 454 + usb_handle = core_alloc_ex(ALLOCATE_BUFFER_SIZE + MAX_CBW_SIZE + 31, 456 455 &buflib_ops_locked); 457 456 if (usb_handle < 0) 458 457 panicf("%s(): OOM", __func__);
+1 -1
lib/rbcodec/dsp/pbe.c
··· 49 49 50 50 static int pbe_buffer_alloc(void) 51 51 { 52 - handle = core_alloc("dsp_pbe_buffer", PBE_BUFSIZE); 52 + handle = core_alloc(PBE_BUFSIZE); 53 53 return handle; 54 54 } 55 55
+1 -1
lib/rbcodec/dsp/surround.c
··· 66 66 67 67 static int surround_buffer_alloc(void) 68 68 { 69 - handle = core_alloc("dsp_surround_buffer", SURROUND_BUFSIZE); 69 + handle = core_alloc(SURROUND_BUFSIZE); 70 70 return handle; 71 71 } 72 72