Ignore:
Timestamp:
Jun 9, 2007, 3:36:46 PM (15 years ago)
Author:
charles
Message:

uninteresting minor stuff like adding const. this commit is just to reduce the shear between trunk and what lands in the file-selection branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r1763 r2004  
    6868 * Local prototypes
    6969 **********************************************************************/
    70 static int  OpenFile( int i, char * folder, char * name, int write );
     70static int  OpenFile( int i, const char * folder, const char * name, int write );
    7171static void CloseFile( int i );
    7272
     
    8585    }
    8686
    87     gFd = calloc( sizeof( tr_fd_t ), 1 );
     87    gFd = calloc( 1, sizeof( tr_fd_t ) );
    8888
    8989    /* Init lock and cond */
     
    126126 * tr_fdFileOpen
    127127 **********************************************************************/
    128 int tr_fdFileOpen( char * folder, char * name, int write )
     128int tr_fdFileOpen( const char * folder, const char * name, int write )
    129129{
    130130    int i, winner, ret;
     
    242242 * tr_fdFileClose
    243243 **********************************************************************/
    244 void tr_fdFileClose( char * folder, char * name )
     244void tr_fdFileClose( const char * folder, const char * name )
    245245{
    246246    int i;
     
    411411 *
    412412 **********************************************************************/
    413 static int OpenFile( int i, char * folder, char * name, int write )
     413static int OpenFile( int i, const char * folder, const char * name, int write )
    414414{
    415415    tr_openFile_t * file = &gFd->open[i];
    416416    struct stat sb;
    417     char * path;
     417    char path[MAX_PATH_LENGTH];
    418418    int ret;
    419419
     
    426426    }
    427427
    428     asprintf( &path, "%s/%s", folder, name );
     428    snprintf( path, sizeof(path), "%s/%s", folder, name );
    429429
    430430    /* Create subfolders, if any */
     
    443443                    ret = tr_ioErrorFromErrno();
    444444                    tr_err( "Could not create folder '%s'", path );
    445                     free( path );
    446445                    return ret;
    447446                }
     
    452451                {
    453452                    tr_err( "Is not a folder: '%s'", path );
    454                     free( path );
    455453                    return TR_ERROR_IO_OTHER;
    456454                }
     
    466464    {
    467465        ret = tr_ioErrorFromErrno();
    468         free( path );
    469466        tr_err( "Could not open %s in %s (%d, %d)", name, folder, write, ret );
    470467        return ret;
    471468    }
    472     free( path );
    473469
    474470    return TR_OK;
Note: See TracChangeset for help on using the changeset viewer.