summaryrefslogtreecommitdiff
path: root/stringsort.c
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2008-11-13 22:07:24 +0000
committerMatt Turner <mattst88@gmail.com>2008-11-13 22:07:24 +0000
commit8a9fd3f93bb3db2d969126913eedab023dba013f (patch)
tree5cd76353b5ec3e8be5c1062c0294e9b402a71487 /stringsort.c
parent9631ec05f6ddc60b231e5fad280e5a5242c5bab3 (diff)
Remove AllocateMemory, FreeMemory, MoveMemory, ErrorExit, and ReportError functions
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@17 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
Diffstat (limited to 'stringsort.c')
-rw-r--r--stringsort.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/stringsort.c b/stringsort.c
index bf38981..d3417a2 100644
--- a/stringsort.c
+++ b/stringsort.c
@@ -135,7 +135,7 @@ do {
** Clean up, calculate results, and go home.
** Set flag to show we don't need to rerun adjustment code.
*/
-FreeMemory((void *)arraybase,&systemerror);
+free(arraybase);
strsortstruct->sortspersec=iterations / (double)TicksToFracSecs(accumtime);
if(strsortstruct->adjust==0)
strsortstruct->adjust=1;
@@ -217,7 +217,7 @@ elapsed=StopStopwatch(elapsed);
** Release the offset pointer array built by
** LoadStringArray()
*/
-FreeMemory((void *)optrarray,&syserror);
+free(optrarray);
/*
** Return elapsed ticks.
@@ -412,9 +412,7 @@ nbytes=*(optrarray+nstrings-1L) +
** Hand this straight to memmove and let it handle the
** "overlap" problem.
*/
-MoveMemory((void *)(strarray+*(optrarray+i)+l+1),
- (void *)(strarray+*(optrarray+i+1)),
- (unsigned long)nbytes);
+memmove(strarray + *(optrarray + i) + l + 1, strarray + *(optrarray + i + 1), nbytes);
/*
** We have to adjust the offset pointer array.
@@ -472,27 +470,18 @@ for(i=top; i>0; --i)
/* temp = string[0] */
tlen=*strarray;
- MoveMemory((void *)&temp[0], /* Perform exchange */
- (void *)strarray,
- (unsigned long)(tlen+1));
-
+ memmove(&temp[0], strarray, tlen + 1);
/* string[0]=string[i] */
tlen=*(strarray+*(optrarray+i));
stradjust(optrarray,strarray,numstrings,0,tlen);
- MoveMemory((void *)strarray,
- (void *)(strarray+*(optrarray+i)),
- (unsigned long)(tlen+1));
+ memmove(strarray, (strarray + *(optrarray + i)), tlen + 1);
/* string[i]=temp */
tlen=temp[0];
stradjust(optrarray,strarray,numstrings,i,tlen);
- MoveMemory((void *)(strarray+*(optrarray+i)),
- (void *)&temp[0],
- (unsigned long)(tlen+1));
-
+ memmove(strarray + *(optrarray + i), &temp[0], tlen + 1);
}
-return;
}
/****************
@@ -572,27 +561,20 @@ while((i+i)<=j)
{
/* temp=string[k] */
tlen=*(strarray+*(optrarray+k));
- MoveMemory((void *)&temp[0],
- (void *)(strarray+*(optrarray+k)),
- (unsigned long)(tlen+1));
+ memmove(&temp[0], strarray + *(optrarray + k), tlen+1);
/* string[k]=string[i] */
tlen=*(strarray+*(optrarray+i));
stradjust(optrarray,strarray,numstrings,k,tlen);
- MoveMemory((void *)(strarray+*(optrarray+k)),
- (void *)(strarray+*(optrarray+i)),
- (unsigned long)(tlen+1));
+ memmove(strarray + *(optrarray + k), strarray + *(optrarray + i), tlen + 1);
/* string[i]=temp */
tlen=temp[0];
stradjust(optrarray,strarray,numstrings,i,tlen);
- MoveMemory((void *)(strarray+*(optrarray+i)),
- (void *)&temp[0],
- (unsigned long)(tlen+1));
+ memmove(strarray + *(optrarray + i), &temp[0], tlen + 1);
i=k;
}
else
i=j+1;
}
-return;
}