vlc | branch: master | Hugo Beauzée-Luyssen <[email protected]> | Thu Dec 17 
16:52:46 2020 +0100| [3103c63b8b434c0f47d88ba5102d526832fff22a] | committer: 
Hugo Beauzée-Luyssen

preparser: art: Remove useless copy

The content is always owned by the called, and since the
ArtCacheCreateDir doesn't change the string content, we can simply use
the string passed in parameter without any need for a copy

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3103c63b8b434c0f47d88ba5102d526832fff22a
---

 src/preparser/art.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/preparser/art.c b/src/preparser/art.c
index b7f0d48411..9fa9e66ba0 100644
--- a/src/preparser/art.c
+++ b/src/preparser/art.c
@@ -37,20 +37,17 @@
 
 #include "art.h"
 
-static void ArtCacheCreateDir( const char *psz_dir )
+static void ArtCacheCreateDir( char *psz_dir )
 {
-    char newdir[strlen( psz_dir ) + 1];
-    strcpy( newdir, psz_dir );
-    char * psz_newdir = newdir;
-    char * psz = psz_newdir;
+    char * psz = psz_dir;
 
     while( *psz )
     {
         while( *psz && *psz != DIR_SEP_CHAR) psz++;
         if( !*psz ) break;
         *psz = 0;
-        if( !EMPTY_STR( psz_newdir ) )
-            vlc_mkdir( psz_newdir, 0700 );
+        if( !EMPTY_STR( psz_dir ) )
+            vlc_mkdir( psz_dir, 0700 );
         *psz = DIR_SEP_CHAR;
         psz++;
     }

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to