(playlist.c) Code style cleanups

This commit is contained in:
twinaphex 2019-04-13 18:57:02 +02:00
parent fb306a9358
commit cee285bcd5

View File

@ -420,7 +420,8 @@ bool playlist_push_runtime(playlist_t *playlist,
struct playlist_entry tmp;
bool equal_path;
equal_path = (!path && !playlist->entries[i].path) ||
equal_path =
(!path && !playlist->entries[i].path) ||
(path && playlist->entries[i].path &&
#ifdef _WIN32
/*prevent duplicates on case-insensitive operating systems*/
@ -553,22 +554,30 @@ bool playlist_push(playlist_t *playlist,
if (!string_is_equal(playlist->entries[i].core_path, entry->core_path))
continue;
if (!string_is_empty(entry->subsystem_ident) && !string_is_empty(playlist->entries[i].subsystem_ident) && !string_is_equal(playlist->entries[i].subsystem_ident, entry->subsystem_ident))
if ( !string_is_empty(entry->subsystem_ident)
&& !string_is_empty(playlist->entries[i].subsystem_ident)
&& !string_is_equal(playlist->entries[i].subsystem_ident, entry->subsystem_ident))
continue;
if (string_is_empty(entry->subsystem_ident) && !string_is_empty(playlist->entries[i].subsystem_ident))
if ( string_is_empty(entry->subsystem_ident)
&& !string_is_empty(playlist->entries[i].subsystem_ident))
continue;
if (!string_is_empty(entry->subsystem_ident) && string_is_empty(playlist->entries[i].subsystem_ident))
if ( !string_is_empty(entry->subsystem_ident)
&& string_is_empty(playlist->entries[i].subsystem_ident))
continue;
if (!string_is_empty(entry->subsystem_name) && !string_is_empty(playlist->entries[i].subsystem_name) && !string_is_equal(playlist->entries[i].subsystem_name, entry->subsystem_name))
if ( !string_is_empty(entry->subsystem_name)
&& !string_is_empty(playlist->entries[i].subsystem_name)
&& !string_is_equal(playlist->entries[i].subsystem_name, entry->subsystem_name))
continue;
if (string_is_empty(entry->subsystem_name) && !string_is_empty(playlist->entries[i].subsystem_name))
if ( string_is_empty(entry->subsystem_name)
&& !string_is_empty(playlist->entries[i].subsystem_name))
continue;
if (!string_is_empty(entry->subsystem_name) && string_is_empty(playlist->entries[i].subsystem_name))
if ( !string_is_empty(entry->subsystem_name)
&& string_is_empty(playlist->entries[i].subsystem_name))
continue;
if (entry->subsystem_roms)
@ -655,6 +664,7 @@ bool playlist_push(playlist_t *playlist,
playlist->entries[0].subsystem_ident = strdup(entry->subsystem_ident);
if (!string_is_empty(entry->subsystem_name))
playlist->entries[0].subsystem_name = strdup(entry->subsystem_name);
if (entry->subsystem_roms)
{
union string_list_elem_attr attributes = {0};
@ -662,11 +672,9 @@ bool playlist_push(playlist_t *playlist,
playlist->entries[0].subsystem_roms = string_list_new();
for (i = 0; i < entry->subsystem_roms->size; i++)
{
string_list_append(playlist->entries[0].subsystem_roms, entry->subsystem_roms->elems[i].data, attributes);
}
}
}
playlist->size++;
@ -690,6 +698,7 @@ static void JSONLogError(JSONContext *pCtx)
{
JSON_Error error = JSON_Parser_GetError(pCtx->parser);
JSON_Location errorLocation = { 0, 0, 0 };
(void)JSON_Parser_GetErrorLocation(pCtx->parser, &errorLocation);
RARCH_WARN("Error: Invalid JSON at line %d, column %d (input byte %d) - %s.\n",
(int)errorLocation.line + 1,
@ -1500,7 +1509,9 @@ static bool playlist_read_file(
goto end;
}
/*JSON_Parser_SetTrackObjectMembers(context.parser, JSON_True);*/
#if 0
JSON_Parser_SetTrackObjectMembers(context.parser, JSON_True);
#endif
JSON_Parser_SetAllowBOM(context.parser, JSON_True);
JSON_Parser_SetAllowComments(context.parser, JSON_True);
JSON_Parser_SetAllowSpecialNumbers(context.parser, JSON_True);
@ -1508,10 +1519,12 @@ static bool playlist_read_file(
JSON_Parser_SetAllowUnescapedControlCharacters(context.parser, JSON_True);
JSON_Parser_SetReplaceInvalidEncodingSequences(context.parser, JSON_True);
/*JSON_Parser_SetNullHandler(context.parser, &JSONNullHandler);
#if 0
JSON_Parser_SetNullHandler(context.parser, &JSONNullHandler);
JSON_Parser_SetBooleanHandler(context.parser, &JSONBooleanHandler);
JSON_Parser_SetSpecialNumberHandler(context.parser, &JSONSpecialNumberHandler);
JSON_Parser_SetArrayItemHandler(context.parser, &JSONArrayItemHandler);*/
JSON_Parser_SetArrayItemHandler(context.parser, &JSONArrayItemHandler);
#endif
JSON_Parser_SetNumberHandler(context.parser, &JSONNumberHandler);
JSON_Parser_SetStringHandler(context.parser, &JSONStringHandler);