Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ diff -u original_onlyjob.c usable_onlyjob.c
- --- original_onlyjob.c 2016-04-03 11:30:29.113618080 -0400
- +++ usable_onlyjob.c 2016-04-03 13:41:24.235069236 -0400
- @@ -7,24 +7,24 @@
- setbuf(stdout,NULL); //disable output buffering
- -char *str=malloc(8);
- +char *str=malloc(9);
- strcpy(str,"abcdefgh");
- -str=realloc(str,strlen(str)+8);
- +str=realloc(str,strlen(str)+1+8);
- strcat(str,"efghefgh"); //sprintf(str,"%s%s",str,"efghefgh");
- -int imax=1024/strlen(str)*1024*4;
- +unsigned int imax=1024/strlen(str)*1024*4;
- printf("%s","exec.tm.sec\tstr.length\n"); //fflush(stdout);
- time_t starttime=time(NULL);
- char *gstr=malloc(0);
- -int i=0;
- +unsigned int i=0;
- char *pos;
- -int lngth;
- +size_t lngth;
- char *pos_c=gstr;
- -int str_len=strlen(str);
- +size_t str_len=strlen(str);
- while(i++ < imax+1000){
- lngth=strlen(str)*i;
- @@ -33,12 +33,12 @@
- pos_c+=str_len;
- pos=gstr;
- - while(pos=strstr(pos,"efgh")){
- + while((pos=strstr(pos,"efgh"))){
- memcpy(pos,"____",4);
- }
- if(lngth % (1024*256)==0){
- - printf("%dsec\t\t%dkb\n",time(NULL)-starttime,lngth/1024); //fflush(stdout);
- + printf("%lusec\t\t%lukb\n",time(NULL)-starttime,lngth/1024); //fflush(stdout);
- }
- }
- //printf("%s\n",gstr);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement