]> git.sesse.net Git - vlc/blobdiff - modules/control/http/http.c
One more removing session. (useless test before a free())
[vlc] / modules / control / http / http.c
index fb39ea788442feca44d69ba7ac4b1d8ec143a9ba..ff46c7d4d5d54c6379420265d31f573f693f33fe 100644 (file)
@@ -22,6 +22,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include "http.h"
 
@@ -198,8 +201,7 @@ static int Open( vlc_object_t *p_this )
             TAB_APPEND( p_sys->i_handlers, p_sys->pp_handlers, p_handler );
         }
     }
-    if( psz_src != NULL )
-        free( psz_src );
+    free( psz_src );
 #endif
 
     /* determine SSL configuration */
@@ -260,19 +262,20 @@ static int Open( vlc_object_t *p_this )
 
     if( ( psz_src == NULL ) || ( *psz_src == '\0' ) )
     {
-        static char const* ppsz_paths[] = {
+        const char *data_path = config_GetDataDir ();
+        char buf[strlen (data_path) + sizeof ("/http")];
+        snprintf (buf, sizeof (buf), "%s/http", data_path);
+
+        const char const* ppsz_paths[] = {
             "share/http",
             "../share/http",
-            DATA_PATH"/http",
+            buf,
             NULL
         };
         unsigned i;
 
-        if( psz_src != NULL )
-        {
-            free( psz_src );
-            psz_src = NULL;
-        }
+        free( psz_src );
+        psz_src = NULL;
 
         for( i = 0; ppsz_paths[i] != NULL; i++ )
             if( !DirectoryCheck( ppsz_paths[i] ) )
@@ -365,10 +368,7 @@ static void Close ( vlc_object_t *p_this )
         free( p_sys->pp_files[i]->name );
         free( p_sys->pp_files[i] );
     }
-    if( p_sys->pp_files )
-    {
-        free( p_sys->pp_files );
-    }
+    free( p_sys->pp_files );
     for( i = 0; i < p_sys->i_handlers; i++ )
     {
         http_association_t *p_handler = p_sys->pp_handlers[i];
@@ -560,6 +560,7 @@ int  E_(HttpCallback)( httpd_file_sys_t *p_args,
                        uint8_t *_p_request,
                        uint8_t **_pp_data, int *pi_data )
 {
+    VLC_UNUSED(p_file);
     char *p_request = (char *)_p_request;
     char **pp_data = (char **)_pp_data;
     FILE *f;
@@ -604,6 +605,7 @@ int  E_(HandlerCallback)( httpd_handler_sys_t *p_args,
                           char *psz_remote_addr, char *psz_remote_host,
                           uint8_t **_pp_data, int *pi_data )
 {
+    VLC_UNUSED(p_handler); VLC_UNUSED(_p_in);
     char *p_url = (char *)_p_url;
     char *p_request = (char *)_p_request;
     char **pp_data = (char **)_pp_data;
@@ -785,8 +787,7 @@ int  E_(HandlerCallback)( httpd_handler_sys_t *p_args,
                 NULL );
     TAB_REMOVE( p_args->p_association->i_argc, p_args->p_association->ppsz_argv,
                 psz_file );
-    if( psz_cwd != NULL )
-        free( psz_cwd );
+    free( psz_cwd );
     while( i_env )
         TAB_REMOVE( i_env, ppsz_env, ppsz_env[0] );
 
@@ -831,6 +832,10 @@ int  E_(ArtCallback)( httpd_handler_sys_t *p_args,
                           char *psz_remote_addr, char *psz_remote_host,
                           uint8_t **pp_data, int *pi_data )
 {
+    VLC_UNUSED(p_handler); VLC_UNUSED(_p_url); VLC_UNUSED(i_type); 
+    VLC_UNUSED(p_in); VLC_UNUSED(i_in); VLC_UNUSED(psz_remote_addr); 
+    VLC_UNUSED(psz_remote_host); 
+
     char *psz_art = NULL;
     intf_thread_t *p_intf = p_args->file.p_intf;
     intf_sys_t *p_sys = p_intf->p_sys;