From: <n-...@us...> - 2007-03-19 05:28:27
|
Revision: 3669 http://gfarm.svn.sourceforge.net/gfarm/?rev=3669&view=rev Author: n-soda Date: 2007-03-18 22:15:10 -0700 (Sun, 18 Mar 2007) Log Message: ----------- make gfexport faster, problem reported by Yamamoto Naotaka-san Modified Paths: -------------- gfarm/trunk/gftool/gfexport/gfexport.c Modified: gfarm/trunk/gftool/gfexport/gfexport.c =================================================================== --- gfarm/trunk/gftool/gfexport/gfexport.c 2007-03-16 15:01:26 UTC (rev 3668) +++ gfarm/trunk/gftool/gfexport/gfexport.c 2007-03-19 05:15:10 UTC (rev 3669) @@ -10,14 +10,23 @@ char *program_name = "gfexport"; +/* from GFS_FILE_BUFSIZE in lib/libgfarm/gfarm/gfs_pio.h */ +#define BUFFER_SIZE 65536 + char * gfprint(GFS_File gf, FILE *ofp) { - int c; + char *e; + char buffer[BUFFER_SIZE]; + int n; - while ((c = gfs_pio_getc(gf)) != EOF) - putc(c, ofp); - return (gfs_pio_error(gf)); + while ((e = gfs_pio_read(gf, buffer, sizeof buffer, &n)) == NULL) { + if (n == 0) /* EOF */ + break; + if (fwrite(buffer, 1, n, ofp) != n) + return ("error at writing, possibly diskfull"); + } + return (e); } char * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |