Skip to content

Commit cb58dbc

Browse files
committed
Use string_list_append_n where appropriate
1 parent 14f3dbb commit cb58dbc

6 files changed

Lines changed: 31 additions & 28 deletions

File tree

gfx/drivers_shader/glslang_util.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,19 @@ bool glslang_read_shader_file(const char *path,
168168

169169
/* Allows us to use #line to make dealing with shader
170170
* errors easier. */
171-
if (!string_list_append(output,
171+
if (!string_list_append_n(output,
172172
"#extension GL_GOOGLE_cpp_style_line_directive : require",
173+
STRLEN_CONST("#extension GL_GOOGLE_cpp_style_line_directive : require"),
173174
attr))
174175
{
175176
*newline = saved;
176177
goto cleanup;
177178
}
178179

179180
/* Append feature defines */
180-
if (!string_list_append(output, "#define _HAS_ORIGINALASPECT_UNIFORMS", attr)
181-
|| !string_list_append(output, "#define _HAS_FRAMETIME_UNIFORMS", attr)
182-
|| !string_list_append(output, "#define _HAS_SENSOR_UNIFORMS", attr))
181+
if (!string_list_append_n(output, "#define _HAS_ORIGINALASPECT_UNIFORMS", STRLEN_CONST("#define _HAS_ORIGINALASPECT_UNIFORMS"), attr)
182+
|| !string_list_append_n(output, "#define _HAS_FRAMETIME_UNIFORMS", STRLEN_CONST("#define _HAS_FRAMETIME_UNIFORMS"), attr)
183+
|| !string_list_append_n(output, "#define _HAS_SENSOR_UNIFORMS", STRLEN_CONST("#define _HAS_SENSOR_UNIFORMS"), attr))
183184
{
184185
*newline = saved;
185186
goto cleanup;
@@ -202,9 +203,9 @@ bool glslang_read_shader_file(const char *path,
202203
/* Non-root or non-slang: emit feature defines + #line once */
203204
if (root_file)
204205
{
205-
if (!string_list_append(output, "#define _HAS_ORIGINALASPECT_UNIFORMS", attr)
206-
|| !string_list_append(output, "#define _HAS_FRAMETIME_UNIFORMS", attr)
207-
|| !string_list_append(output, "#define _HAS_SENSOR_UNIFORMS", attr))
206+
if (!string_list_append_n(output, "#define _HAS_ORIGINALASPECT_UNIFORMS", STRLEN_CONST("#define _HAS_ORIGINALASPECT_UNIFORMS"), attr)
207+
|| !string_list_append_n(output, "#define _HAS_FRAMETIME_UNIFORMS", STRLEN_CONST("#define _HAS_FRAMETIME_UNIFORMS"), attr)
208+
|| !string_list_append_n(output, "#define _HAS_SENSOR_UNIFORMS", STRLEN_CONST("#define _HAS_SENSOR_UNIFORMS"), attr))
208209
{
209210
*newline = saved;
210211
goto cleanup;
@@ -219,9 +220,9 @@ bool glslang_read_shader_file(const char *path,
219220
}
220221
else
221222
{
222-
if (!string_list_append(output, "#define _HAS_ORIGINALASPECT_UNIFORMS", attr)
223-
|| !string_list_append(output, "#define _HAS_FRAMETIME_UNIFORMS", attr)
224-
|| !string_list_append(output, "#define _HAS_SENSOR_UNIFORMS", attr))
223+
if (!string_list_append_n(output, "#define _HAS_ORIGINALASPECT_UNIFORMS", STRLEN_CONST("#define _HAS_ORIGINALASPECT_UNIFORMS"), attr)
224+
|| !string_list_append_n(output, "#define _HAS_FRAMETIME_UNIFORMS", STRLEN_CONST("#define _HAS_FRAMETIME_UNIFORMS"), attr)
225+
|| !string_list_append_n(output, "#define _HAS_SENSOR_UNIFORMS", STRLEN_CONST("#define _HAS_SENSOR_UNIFORMS"), attr))
225226
{
226227
*newline = saved;
227228
goto cleanup;

menu/cbs/menu_cbs_ok.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6240,8 +6240,8 @@ static int action_ok_add_entry_to_playlist(const char *path,
62406240
}
62416241
else
62426242
{
6243-
string_list_append(str_list, FILE_PATH_DETECT, attr);
6244-
string_list_append(str_list, FILE_PATH_DETECT, attr);
6243+
string_list_append_n(str_list, FILE_PATH_DETECT, STRLEN_CONST(FILE_PATH_DETECT), attr);
6244+
string_list_append_n(str_list, FILE_PATH_DETECT, STRLEN_CONST(FILE_PATH_DETECT), attr);
62456245
}
62466246

62476247
/* crc32 */
@@ -6415,7 +6415,8 @@ static int action_ok_add_to_favorites_playlist(const char *path,
64156415
* (always use display name, if available) */
64166416
if (core_info_find(core_path, &core_info))
64176417
if (!string_is_empty(core_info->display_name))
6418-
strlcpy(core_display_name, core_info->display_name, sizeof(core_display_name));
6418+
strlcpy(core_display_name, core_info->display_name,
6419+
sizeof(core_display_name));
64196420

64206421
if (!string_is_empty(core_display_name))
64216422
string_list_append(str_list, core_display_name, attr);
@@ -6424,8 +6425,8 @@ static int action_ok_add_to_favorites_playlist(const char *path,
64246425
}
64256426
else
64266427
{
6427-
string_list_append(str_list, FILE_PATH_DETECT, attr);
6428-
string_list_append(str_list, FILE_PATH_DETECT, attr);
6428+
string_list_append_n(str_list, FILE_PATH_DETECT, STRLEN_CONST(FILE_PATH_DETECT), attr);
6429+
string_list_append_n(str_list, FILE_PATH_DETECT, STRLEN_CONST(FILE_PATH_DETECT), attr);
64296430
}
64306431

64316432
/* crc32 */

retroarch.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,8 @@ static bool rarch_midi_drv_output_pending;
567567

568568
static void null_midi_free(void *p) { }
569569
static void *null_midi_init(const char *input, const char *output) { return (void*)-1; }
570-
static bool null_midi_get_avail_inputs(struct string_list *inputs) { union string_list_elem_attr attr = {0}; return string_list_append(inputs, "Null", attr); }
571-
static bool null_midi_get_avail_outputs(struct string_list *outputs) { union string_list_elem_attr attr = {0}; return string_list_append(outputs, "Null", attr); }
570+
static bool null_midi_get_avail_inputs(struct string_list *inputs) { union string_list_elem_attr attr = {0}; return string_list_append_n(inputs, "Null", STRLEN_CONST("Null"), attr); }
571+
static bool null_midi_get_avail_outputs(struct string_list *outputs) { union string_list_elem_attr attr = {0}; return string_list_append_n(outputs, "Null", STRLEN_CONST("Null"), attr); }
572572
static bool null_midi_set_input(void *p, const char *input) { return input == NULL || string_is_equal(input, "Null"); }
573573
static bool null_midi_set_output(void *p, const char *output) { return output == NULL || string_is_equal(output, "Null"); }
574574
static bool null_midi_read(void *p, midi_event_t *event) { return false; }
@@ -782,8 +782,8 @@ static bool midi_driver_init(void *data)
782782

783783
if (!rarch_midi_drv_inputs || !rarch_midi_drv_outputs)
784784
ret = false;
785-
else if (!string_list_append(rarch_midi_drv_inputs, MIDI_DRIVER_OFF, attr) ||
786-
!string_list_append(rarch_midi_drv_outputs, MIDI_DRIVER_OFF, attr))
785+
else if (!string_list_append_n(rarch_midi_drv_inputs, MIDI_DRIVER_OFF, STRLEN_CONST(MIDI_DRIVER_OFF), attr) ||
786+
!string_list_append_n(rarch_midi_drv_outputs, MIDI_DRIVER_OFF, STRLEN_CONST(MIDI_DRIVER_OFF), attr))
787787
ret = false;
788788
else
789789
{

tasks/task_cloudsync.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,31 +357,32 @@ static struct string_list *task_cloud_sync_directory_map(void)
357357

358358
if (settings->bools.cloud_sync_sync_configs)
359359
{
360-
string_list_append(list, "config", attr);
360+
string_list_append_n(list, "config", STRLEN_CONST("config"), attr);
361361
fill_pathname_application_special(dir,
362362
sizeof(dir), APPLICATION_SPECIAL_DIRECTORY_CONFIG);
363363
list->elems[list->size - 1].userdata = strdup(dir);
364364
}
365365

366366
if (settings->bools.cloud_sync_sync_saves)
367367
{
368-
string_list_append(list, "saves", attr);
368+
string_list_append_n(list, "saves", STRLEN_CONST("saves"), attr);
369369
list->elems[list->size - 1].userdata = strdup(dir_get_ptr(RARCH_DIR_SAVEFILE));
370370

371-
string_list_append(list, "states", attr);
371+
string_list_append_n(list, "states", STRLEN_CONST("states"), attr);
372372
list->elems[list->size - 1].userdata = strdup(dir_get_ptr(RARCH_DIR_SAVESTATE));
373373
}
374374

375375
if (settings->bools.cloud_sync_sync_thumbs)
376376
{
377-
string_list_append(list, "thumbnails", attr);
377+
string_list_append_n(list, "thumbnails", STRLEN_CONST("thumbnails"),
378+
attr);
378379
strlcpy(dir, settings->paths.directory_thumbnails, sizeof(dir));
379380
list->elems[list->size - 1].userdata = strdup(dir);
380381
}
381382

382383
if (settings->bools.cloud_sync_sync_system)
383384
{
384-
string_list_append(list, "system", attr);
385+
string_list_append_n(list, "system", STRLEN_CONST("system"), attr);
385386
strlcpy(dir, settings->paths.directory_system, sizeof(dir));
386387
list->elems[list->size - 1].userdata = strdup(dir);
387388
}

tasks/task_content.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static const char *content_file_list_append_temporary(
466466
return NULL;
467467
}
468468

469-
/* Note: Takes ownership of supplied 'data' buffer */
469+
/* NOTE: Takes ownership of supplied 'data' buffer */
470470
static bool content_file_list_set_info(
471471
content_file_list_t *file_list,
472472
const char *path,
@@ -1287,8 +1287,8 @@ static void content_file_set_attributes(
12871287
{
12881288
if ( (flags & CONTENT_ST_FLAG_CORE_DOES_NOT_NEED_CONTENT)
12891289
&& content_ctx->flags
1290-
& CONTENT_INFO_FLAG_SET_SUPPORTS_NO_GAME_ENABLE)
1291-
string_list_append(content, "", attr);
1290+
& CONTENT_INFO_FLAG_SET_SUPPORTS_NO_GAME_ENABLE)
1291+
string_list_append_n(content, "", STRLEN_CONST(""), attr);
12921292
}
12931293
else
12941294
string_list_append(content, content_path, attr);

tasks/task_database.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2190,7 +2190,7 @@ static void task_manual_content_scan_handler(retro_task_t *task)
21902190
{
21912191
union string_list_elem_attr attr;
21922192
attr.i = 0;
2193-
/* Note: If string_list_append() fails, there is
2193+
/* NOTE: If string_list_append() fails, there is
21942194
* really nothing we can do. The M3U file will
21952195
* just be ignored... */
21962196
string_list_append(

0 commit comments

Comments
 (0)