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.

[Bug Fix] filetypes.c move voice data out of INIT_ATTR

tree_get_filetype_voiceclip is called after init it shouldn't be marked as INIT_ATTR

add _init to the functions & data that are used at init only to be a bit more clear

Change-Id: I8eb1914560b782c2c0fdd7649e761f94e382d5cb

authored by

William Wilgus and committed by
William Wilgus
c6c1d624 8ff2c81b

+13 -21
+11 -15
apps/filetypes.c
··· 46 46 /* max viewer plugins */ 47 47 #define MAX_VIEWERS 56 48 48 49 + static void read_builtin_types_init(void) INIT_ATTR; 50 + static void read_viewers_config_init(void) INIT_ATTR; 51 + static void read_config_init(int fd) INIT_ATTR; 52 + 49 53 /* a table for the known file types */ 50 54 static const struct filetype inbuilt_filetypes[] = { 51 55 { "mp3", FILE_ATTR_AUDIO }, ··· 187 191 #endif 188 192 }; 189 193 190 - void tree_get_filetypes(const struct filetype** types, int* count) 191 - { 192 - *types = inbuilt_filetypes; 193 - *count = sizeof(inbuilt_filetypes) / sizeof(*inbuilt_filetypes); 194 - } 195 - 196 194 long tree_get_filetype_voiceclip(int attr) 197 195 { 198 196 if (global_settings.talk_filetype) ··· 306 304 return -1; 307 305 } 308 306 309 - static void read_builtin_types(void); 310 - static void read_config(int fd); 311 307 #ifdef HAVE_LCD_COLOR 312 308 /* Colors file format is similar to icons: 313 309 * ext:hex_color ··· 401 397 custom_icons_loaded = true; 402 398 } 403 399 404 - static void read_viewers_config(void) 400 + static void read_viewers_config_init(void) 405 401 { 406 402 int fd = open(VIEWERS_CONFIG, O_RDONLY); 407 403 if(fd < 0) ··· 417 413 if(strdup_handle <= 0) 418 414 goto out; 419 415 420 - read_config(fd); 416 + read_config_init(fd); 421 417 core_shrink(strdup_handle, core_get_data(strdup_handle), strdup_cur_idx); 422 418 423 419 out: 424 420 close(fd); 425 421 } 426 422 427 - void filetype_init(void) 423 + void filetype_init(void) 428 424 { 429 425 /* set the directory item first */ 430 426 filetypes[0].extension = NULL; ··· 435 431 viewer_count = 0; 436 432 filetype_count = 1; 437 433 438 - read_builtin_types(); 439 - read_viewers_config(); 434 + read_builtin_types_init(); 435 + read_viewers_config_init(); 440 436 read_viewer_theme_file(); 441 437 #ifdef HAVE_LCD_COLOR 442 438 read_color_theme_file(); ··· 459 455 *s = '\0'; 460 456 } 461 457 462 - static void read_builtin_types(void) 458 + static void read_builtin_types_init(void) 463 459 { 464 460 int tree_attr; 465 461 size_t count = ARRAY_SIZE(inbuilt_filetypes); ··· 487 483 } 488 484 } 489 485 490 - static void read_config(int fd) 486 + static void read_config_init(int fd) 491 487 { 492 488 char line[64], *s, *e; 493 489 char *extension, *plugin;
+2 -2
apps/filetypes.h
··· 55 55 int tree_attr; 56 56 }; 57 57 58 - void tree_get_filetypes(const struct filetype**, int*) INIT_ATTR; 59 - long tree_get_filetype_voiceclip(int attr) INIT_ATTR; 58 + long tree_get_filetype_voiceclip(int attr); 60 59 61 60 /* init the filetypes structs. 62 61 uses audio buffer for storage, so call early in init... */ 63 62 void filetype_init(void) INIT_ATTR; 63 + 64 64 void read_viewer_theme_file(void); 65 65 #ifdef HAVE_LCD_COLOR 66 66 void read_color_theme_file(void);
-4
apps/tree.c
··· 77 77 78 78 #include "root_menu.h" 79 79 80 - static const struct filetype *filetypes; 81 - static int filetypes_count; 82 - 83 80 static struct gui_synclist tree_lists; 84 81 85 82 /* I put it here because other files doesn't use it yet, ··· 1090 1087 cache->entries_handle = core_alloc_ex("tree entries", 1091 1088 cache->max_entries*(sizeof(struct entry)), 1092 1089 &ops); 1093 - tree_get_filetypes(&filetypes, &filetypes_count); 1094 1090 } 1095 1091 1096 1092 bool bookmark_play(char *resume_file, int index, unsigned long elapsed,