Changeset aae60936d25a41b92b4827c2c7b32ee2b3b5266c

Show
Ignore:
Timestamp:
02/04/08 22:43:29 (8 months ago)
Author:
Antoine Cellerier <dionoea@videolan.org>
git-committer:
Antoine Cellerier <dionoea@videolan.org> 1207169009 +0200
git-parent:

[4ad218c25fb08d55b944e1c78c20cb96492f6267]

git-author:
Antoine Cellerier <dionoea@videolan.org> 1207169009 +0200
Message:

Simplify code reading.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/misc/lua/vlc.c

    r4ad218c raae6093  
    406406                     char **ppsz_dir_list ) 
    407407{ 
    408     if( asprintf( &ppsz_dir_list[0], "%s" DIR_SEP "lua" DIR_SEP "%s", 
     408    int i = 0; 
     409    if( asprintf( &ppsz_dir_list[i], "%s" DIR_SEP "lua" DIR_SEP "%s", 
    409410                   p_this->p_libvlc->psz_datadir, luadirname ) < 0 ) 
    410411        return VLC_ENOMEM; 
     412    i++; 
    411413 
    412414#   if defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32) 
    413415    { 
    414416        const char *psz_vlcpath = config_GetDataDir(); 
    415         if( asprintf( &ppsz_dir_list[1], "%s" DIR_SEP "lua" DIR_SEP "%s", 
     417        if( asprintf( &ppsz_dir_list[i], "%s" DIR_SEP "lua" DIR_SEP "%s", 
    416418                      psz_vlcpath, luadirname )  < 0 ) 
    417419            return VLC_ENOMEM; 
    418  
    419         if( asprintf( &ppsz_dir_list[2], "%s" DIR_SEP "share" DIR_SEP "lua" DIR_SEP "%s", 
     420        i++; 
     421 
     422        if( asprintf( &ppsz_dir_list[i], "%s" DIR_SEP "share" DIR_SEP "lua" DIR_SEP "%s", 
    420423                      psz_vlcpath, luadirname )  < 0 ) 
    421424            return VLC_ENOMEM; 
     425        i++; 
    422426    } 
    423427#   else 
    424     if( asprintf( &ppsz_dir_list[1], 
     428    if( asprintf( &ppsz_dir_list[i], 
    425429                  "share" DIR_SEP "lua" DIR_SEP "%s", luadirname ) < 0 ) 
    426430        return VLC_ENOMEM; 
     
    429433    { 
    430434        struct stat stat_info; 
    431         if( ( utf8_stat( ppsz_dir_list[1], &stat_info ) == -1 ) 
     435        if( ( utf8_stat( ppsz_dir_list[i], &stat_info ) == -1 ) 
    432436            || !S_ISDIR( stat_info.st_mode ) ) 
    433437        { 
    434             free(ppsz_dir_list[1]); 
    435             if( asprintf( &ppsz_dir_list[1], "%s" DIR_SEP "lua" DIR_SEP "%s", 
     438            free(ppsz_dir_list[i]); 
     439            if( asprintf( &ppsz_dir_list[i], "%s" DIR_SEP "lua" DIR_SEP "%s", 
    436440                          config_GetDataDir (), luadirname ) < 0 ) 
    437441                return VLC_ENOMEM; 
     
    439443    } 
    440444#   endif 
     445    i++; 
    441446#   endif 
    442447    return VLC_SUCCESS;