Small variable cleanups - should make no functional difference

This commit is contained in:
libretroadmin 2025-07-17 04:40:42 +02:00
parent 19f6d94a78
commit d8725d77bb
4 changed files with 17 additions and 24 deletions

View File

@ -385,11 +385,9 @@ static bool playlist_path_equal(const char *real_path,
if (delim) if (delim)
{ {
char compressed_path_b[PATH_MAX_LENGTH]; char compressed_path_b[PATH_MAX_LENGTH];
unsigned len = (unsigned)(1 + delim - full_path); size_t len = (1 + delim - full_path);
strlcpy(compressed_path_b, full_path, strlcpy(compressed_path_b, full_path,
(len < PATH_MAX_LENGTH ? len : PATH_MAX_LENGTH) * sizeof(char)); (len < PATH_MAX_LENGTH ? len : PATH_MAX_LENGTH) * sizeof(char));
#ifdef _WIN32 #ifdef _WIN32
/* Handle case-insensitive operating systems*/ /* Handle case-insensitive operating systems*/
if (string_is_equal_noncase(compressed_path_a, compressed_path_b)) if (string_is_equal_noncase(compressed_path_a, compressed_path_b))

View File

@ -2158,14 +2158,14 @@ struct string_list *dir_list_new_special(const char *input_dir,
} }
static struct string_list *string_list_new_special( static struct string_list *string_list_new_special(
enum string_list_type type, unsigned *len) enum string_list_type type, size_t *len)
{ {
int i;
union string_list_elem_attr attr; union string_list_elem_attr attr;
unsigned i;
struct string_list *s = string_list_new(); struct string_list *s = string_list_new();
if (!s || !len) if (!s)
goto error; return NULL;
attr.i = 0; attr.i = 0;
*len = 0; *len = 0;
@ -2370,24 +2370,21 @@ static struct string_list *string_list_new_special(
#endif #endif
case STRING_LIST_NONE: case STRING_LIST_NONE:
default: default:
goto error; string_list_free(s);
s = NULL;
return NULL;
} }
return s; return s;
error:
string_list_free(s);
s = NULL;
return NULL;
} }
const char *char_list_new_special(enum string_list_type type, void *data) const char *char_list_new_special(enum string_list_type type, void *data)
{ {
unsigned len = 0; size_t _len = 0;
struct string_list *s = string_list_new_special(type, &len); struct string_list *s = string_list_new_special(type, &_len);
char *opt = (len > 0) ? (char*)calloc(len, sizeof(char)): NULL; char *opt = (_len > 0) ? (char*)calloc(_len, sizeof(char)): NULL;
if (opt && s) if (opt && s)
string_list_join_concat(opt, len, s, "|"); string_list_join_concat(opt, _len, s, "|");
string_list_free(s); string_list_free(s);
s = NULL; s = NULL;
return opt; return opt;
@ -4507,15 +4504,15 @@ bool command_event(enum event_command cmd, void *data)
{ {
#ifdef HAVE_MENU #ifdef HAVE_MENU
struct string_list *str_list = (struct string_list*)data; struct string_list *str_list = (struct string_list*)data;
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
if (str_list) if (str_list)
{ {
if (str_list->size >= 7) if (str_list->size >= 7)
{ {
playlist_config_t playlist_config;
playlist_t * playlist; playlist_t * playlist;
playlist_config_t playlist_config;
struct playlist_entry entry = {0}; struct playlist_entry entry = {0};
bool playlist_sort_alphabetical = settings->bools.playlist_sort_alphabetical; bool playlist_sort_alphabetical = settings->bools.playlist_sort_alphabetical;

View File

@ -169,7 +169,7 @@ static const blissbox_pad_type_t* input_autoconfigure_get_blissbox_pad_type_win3
LPTSTR lp_device_path = NULL; LPTSTR lp_device_path = NULL;
char *device_path = NULL; char *device_path = NULL;
DWORD index = 0; DWORD index = 0;
unsigned len = 0; size_t len = 0;
unsigned i = 0; unsigned i = 0;
char vidPidString[32] = {0}; char vidPidString[32] = {0};
char report[USB_PACKET_CTRL_LEN + 1] = {0}; char report[USB_PACKET_CTRL_LEN + 1] = {0};

View File

@ -168,7 +168,6 @@ task_finished:
{ {
size_t _len = 0; size_t _len = 0;
char *tmp = (char*)net_http_data(http->handle, &_len, false); char *tmp = (char*)net_http_data(http->handle, &_len, false);
struct string_list *headers = net_http_headers(http->handle);
if (!tmp) if (!tmp)
tmp = (char*)net_http_data(http->handle, &_len, true); tmp = (char*)net_http_data(http->handle, &_len, true);
@ -177,7 +176,6 @@ task_finished:
{ {
if (tmp) if (tmp)
free(tmp); free(tmp);
string_list_free(headers);
task_set_error(task, task_set_error(task,
strldup("Task cancelled.", sizeof("Task cancelled."))); strldup("Task cancelled.", sizeof("Task cancelled.")));
@ -187,8 +185,8 @@ task_finished:
bool mute; bool mute;
data = (http_transfer_data_t*)malloc(sizeof(*data)); data = (http_transfer_data_t*)malloc(sizeof(*data));
data->data = tmp; data->data = tmp;
data->headers = headers;
data->len = _len; data->len = _len;
data->headers = net_http_headers(http->handle);
data->status = net_http_status(http->handle); data->status = net_http_status(http->handle);
task_set_data(task, data); task_set_data(task, data);