Ticket #3464: mc-3464-cleanup-compute_namelen.patch

File mc-3464-cleanup-compute_namelen.patch, 2.0 KB (added by and, 10 years ago)
  • lib/fs.h

    remove unneeded compute_namelen() function
    
    always DIRENT_LENGTH_COMPUTED 1 -> compute_namelen() returns without functional logic
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    
    a b  
    100100 
    101101/* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */ 
    102102#define NLENGTH(dirent) (strlen ((dirent)->d_name)) 
    103 #define DIRENT_LENGTH_COMPUTED 1 
    104103 
    105104/* DragonFlyBSD doesn't provide MAXNAMLEN macro */ 
    106105#ifndef MAXNAMLEN 
     
    122121 
    123122/*** inline functions ****************************************************************************/ 
    124123 
    125 static inline void 
    126 compute_namelen (struct dirent *dent __attribute__ ((unused))) 
    127 { 
    128 #ifdef DIRENT_LENGTH_COMPUTED 
    129     (void) dent; 
    130     return; 
    131 #else 
    132     dent->d_namlen = strlen (dent); 
    133 #endif 
    134 } 
    135  
    136124#endif 
  • lib/vfs/direntry.c

    a b  
    448448    else 
    449449        vfs_die ("Null in structure-cannot happen"); 
    450450 
    451     compute_namelen (&dir.dent); 
    452451    info->cur = g_list_next (info->cur); 
    453452 
    454453    return (void *) &dir; 
  • src/vfs/extfs/extfs.c

    a b  
    10611061 
    10621062    g_strlcpy (dir.dent.d_name, (*info)->name, MC_MAXPATHLEN); 
    10631063 
    1064     compute_namelen (&dir.dent); 
    10651064    *info = (*info)->next_in_dir; 
    10661065 
    10671066    return (void *) &dir; 
  • src/vfs/sftpfs/dir.c

    a b  
    149149        return NULL; 
    150150 
    151151    g_strlcpy (sftpfs_dirent.dent.d_name, mem, BUF_MEDIUM); 
    152     compute_namelen (&sftpfs_dirent.dent); 
    153152    return &sftpfs_dirent; 
    154153} 
    155154 
  • src/vfs/smbfs/smbfs.c

    a b  
    939939    g_strlcpy (dirent_dest, smbfs_info->current->text, MC_MAXPATHLEN); 
    940940    smbfs_info->current = smbfs_info->current->next; 
    941941 
    942     compute_namelen (&smbfs_readdir_data.dent); 
    943  
    944942    return &smbfs_readdir_data; 
    945943} 
    946944 
  • src/vfs/undelfs/undelfs.c

    a b  
    414414                    (long) delarray[readdir_ptr].ino, delarray[readdir_ptr].num_blocks); 
    415415    readdir_ptr++; 
    416416 
    417     compute_namelen (&undelfs_readdir_data.dent); 
    418  
    419417    return &undelfs_readdir_data; 
    420418} 
    421419