From 159906a5522cfea2b6b061cae719921dd4b494e3 Mon Sep 17 00:00:00 2001 From: Steve Lhomme <robux4@ycbcr.xyz> Date: Fri, 2 Sep 2022 06:35:56 +0200 Subject: [PATCH] modules: optimize empty string check --- modules/codec/webvtt/subsvtt.c | 2 +- modules/gui/macosx/coreinteraction/VLCVideoFilterHelper.m | 2 +- modules/stream_filter/hds/hds.c | 2 +- modules/stream_out/rtsp.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/codec/webvtt/subsvtt.c b/modules/codec/webvtt/subsvtt.c index b69260ac44c2..ca4d4bf37e67 100644 --- a/modules/codec/webvtt/subsvtt.c +++ b/modules/codec/webvtt/subsvtt.c @@ -734,7 +734,7 @@ static bool webvtt_domnode_Match_Attribute( const webvtt_dom_node_t *p_node, psz_start = p_tagnode->psz_attrs; if( !p_matchsel ) /* attribute check only */ - return strlen( psz_start ) > 0; + return *psz_start != '\0'; return MatchAttribute( psz_start, p_matchsel->psz_name, p_matchsel->match ); } diff --git a/modules/gui/macosx/coreinteraction/VLCVideoFilterHelper.m b/modules/gui/macosx/coreinteraction/VLCVideoFilterHelper.m index e0ef0cd438d5..3b1ea31e8d4c 100644 --- a/modules/gui/macosx/coreinteraction/VLCVideoFilterHelper.m +++ b/modules/gui/macosx/coreinteraction/VLCVideoFilterHelper.m @@ -99,7 +99,7 @@ } /* Remove trailing : : */ - if (strlen(psz_string) > 0 && *(psz_string + strlen(psz_string) -1) == ':') + if (*psz_string != '\0' && *(psz_string + strlen(psz_string) -1) == ':') *(psz_string + strlen(psz_string) -1) = '\0'; } else { free(psz_string); diff --git a/modules/stream_filter/hds/hds.c b/modules/stream_filter/hds/hds.c index 65744ef01276..c8944ccc59ef 100644 --- a/modules/stream_filter/hds/hds.c +++ b/modules/stream_filter/hds/hds.c @@ -761,7 +761,7 @@ static uint8_t* download_chunk( stream_t *s, const char* quality = ""; char* server_base = sys->base_url; if( stream->server_entry_count > 0 && - strlen(stream->server_entries[0]) > 0 ) + stream->server_entries[0][0] != '\0' ) { server_base = stream->server_entries[0]; } diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c index 8d79803c8e03..4bf26a9140db 100644 --- a/modules/stream_out/rtsp.c +++ b/modules/stream_out/rtsp.c @@ -196,7 +196,7 @@ static void RtspTrackClose( rtsp_strack_t *tr ); char *RtspAppendTrackPath( rtsp_stream_id_t *id, const char *base ) { - const char *sep = strlen( base ) > 0 && base[strlen( base ) - 1] == '/' ? + const char *sep = *base != '\0' && base[strlen( base ) - 1] == '/' ? "" : "/"; char *url; -- GitLab