Changeset 10186
- Timestamp:
- Feb 12, 2010, 7:59:30 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r10177 r10186 109 109 AC_HEADER_TIME 110 110 111 AC_CHECK_FUNCS([pread pwrite lrintf strlcpy daemon dirname basename strcasecmp localtime_r fallocate64 posix_fallocate memmem strtold syslog ])111 AC_CHECK_FUNCS([pread pwrite lrintf strlcpy daemon dirname basename strcasecmp localtime_r fallocate64 posix_fallocate memmem strtold syslog valloc]) 112 112 AC_PROG_INSTALL 113 113 AC_PROG_MAKE_SET -
trunk/libtransmission/verify.c
r9868 r10186 20 20 #include <fcntl.h> /* posix_fadvise() / fcntl() */ 21 21 #endif 22 #if defined(SYS_DARWIN) 23 #define HAVE_VALLOC 24 #endif 22 25 23 26 #include <openssl/sha.h> … … 58 61 tr_file_index_t fileIndex = 0; 59 62 tr_piece_index_t pieceIndex = 0; 60 const int64_t buflen = tor->info.pieceSize;61 uint8_t * buffer = tr_new( uint8_t, buflen );63 uint8_t * buffer = NULL; 64 int64_t buflen = 0; 62 65 const time_t begin = tr_time( ); 63 66 time_t end; … … 85 88 fd = filename == NULL ? -1 : tr_open_file_for_scanning( filename ); 86 89 /* fprintf( stderr, "opening file #%d (%s) -- %d\n", fileIndex, filename, fd ); */ 90 if( ( fd >= 0 ) && ( buffer == NULL ) ) 91 { 92 struct stat st; 93 buflen = fstat( fd, &st ) ? 4096 : st.st_blksize; 94 #ifdef HAVE_VALLOC 95 buffer = valloc( buflen ); 96 #else 97 buffer = malloc( buflen ); 98 #endif 99 } 87 100 tr_free( filename ); 88 101 } … … 165 178 if( fd >= 0 ) 166 179 tr_close_file( fd ); 167 tr_free( buffer );180 free( buffer ); 168 181 169 182 /* stopwatch */
Note: See TracChangeset
for help on using the changeset viewer.