Use STRLEN_CONST where possible

This commit is contained in:
twinaphex 2020-06-24 22:57:41 +02:00
parent 67898f5d12
commit 8fccac666e
2 changed files with 5 additions and 4 deletions

View File

@ -1371,7 +1371,8 @@ struct string_list* cdrom_get_available_drives(void)
if (!is_cdrom)
continue;
sscanf(dir_list->elems[i].data + strlen("/dev/sg"), "%d", &dev_index);
sscanf(dir_list->elems[i].data + STRLEN_CONST("/dev/sg"),
"%d", &dev_index);
dev_index = '0' + dev_index;
attr.i = dev_index;

View File

@ -129,7 +129,7 @@ static bool m3u_file_load(m3u_file_t *m3u_file)
continue;
/* Determine line 'type' */
m3u_size = strlen(M3U_FILE_NONSTD_LABEL);
m3u_size = STRLEN_CONST(M3U_FILE_NONSTD_LABEL);
/* > '#LABEL:' */
if (!strncmp(
@ -151,12 +151,12 @@ static bool m3u_file_load(m3u_file_t *m3u_file)
/* > '#EXTINF:' */
else if (!strncmp(
line, M3U_FILE_EXTSTD_LABEL,
strlen(M3U_FILE_EXTSTD_LABEL)))
STRLEN_CONST(M3U_FILE_EXTSTD_LABEL)))
{
/* Label is the string to the right
* of the first comma */
const char* label_ptr = strchr(
line + strlen(M3U_FILE_EXTSTD_LABEL),
line + STRLEN_CONST(M3U_FILE_EXTSTD_LABEL),
M3U_FILE_EXTSTD_LABEL_TOKEN);
if (!string_is_empty(label_ptr))