From: teodor Date: Thu, 10 Feb 2005 16:46:25 +0000 (+0000) Subject: more coorect comparing X-Git-Url: http://www.sigaev.ru/git/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=8860fab0d48d01f3f48928780d47a126707c7b56;p=tedtools.git more coorect comparing --- diff --git a/memtest.c b/memtest.c index 2cb2040..223b49b 100644 --- a/memtest.c +++ b/memtest.c @@ -41,7 +41,7 @@ static void usage() { puts( "Usage:\n" - "memtest [-c COUNT [-m]]\n" + "memtest [-c COUNT [-t]]\n" ); exit(1); } @@ -60,12 +60,12 @@ main(int argn, char *argv[]) { opentlog(TL_OPEN_STDERR,TL_DEBUG, NULL); opterr=0; - while((i=getopt(argn,argv,"c:hm")) != EOF) { + while((i=getopt(argn,argv,"c:ht")) != EOF) { switch(i) { case 'c': count=atoi(optarg); break; - case 'm': + case 't': iscntx=1; break; case 'h': @@ -156,11 +156,15 @@ main(int argn, char *argv[]) { *ptr = (i+3)%256; } + freeMemoryContext(base); printf("MC elapsed: %f sec\n", elapsedtime(&begin)); - freeMemoryContext(base); } else { + char **all, **allptr; gettimeofday(&begin, NULL); + allptr=all=malloc(sizeof(char*)*count*2); + if ( !all ) + tlog(TL_CRIT|TL_EXIT,"No memory"); for(i=0;i