1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[perf] Optimize check for zero length string

strlen has O(n) complexity, checking for first
string char is '\0' just O(1).
This commit is contained in:
Tsarevich Dmitry 2020-02-23 18:08:21 +03:00
parent f667dd6616
commit c499da9364
No known key found for this signature in database
GPG key ID: E3C61298FF5B1274

View file

@ -445,7 +445,7 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha
while ((p_udf_dirent = udf_readdir(p_udf_dirent)) != NULL) {
if (FormatStatus) goto out;
psz_basename = udf_get_filename(p_udf_dirent);
if (strlen(psz_basename) == 0)
if (psz_basename[0] == '\0')
continue;
length = (int)(3 + strlen(psz_path) + strlen(psz_basename) + strlen(psz_extract_dir) + 24);
psz_fullpath = (char*)calloc(sizeof(char), length);