projects
/
tedtools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1954bf4
)
fixes in mcrealloc
author
teodor
<teodor>
Tue, 22 Nov 2005 15:33:21 +0000
(15:33 +0000)
committer
teodor
<teodor>
Tue, 22 Nov 2005 15:33:21 +0000
(15:33 +0000)
memtest.c
patch
|
blob
|
history
tbtree.c
patch
|
blob
|
history
tmalloc.c
patch
|
blob
|
history
diff --git
a/memtest.c
b/memtest.c
index
a4536d5
..
7db7813
100644
(file)
--- a/
memtest.c
+++ b/
memtest.c
@@
-118,14
+118,14
@@
main(int argn, char *argv[]) {
printf("mixed:%s free:%d\n", ptr, base->chunk->freesize);
ptr = mcrealloc(ptr1, 120);
printf("mixed:%s free:%d\n", ptr, base->chunk->freesize);
ptr = mcrealloc(ptr1, 120);
- tassert( ptr
==
ptr1 );
+ tassert( ptr
<
ptr1 );
printf("mixed:%s free:%d\n", ptr, base->chunk->freesize);
printf("mixed:%s free:%d\n", ptr, base->chunk->freesize);
- ptr = mcalloc(base, CNTXCHUNK);
- strcpy(ptr
, ptr1
);
+ ptr
1
= mcalloc(base, CNTXCHUNK);
+ strcpy(ptr
1, ptr
);
printf("mixed:%s free:%d freenew:%d\n", ptr1, base->chunk->freesize, base->chunk->next->freesize);
printf("mixed:%s free:%d freenew:%d\n", ptr1, base->chunk->freesize, base->chunk->next->freesize);
- ptr
= mcstrdup(child, ptr1
);
+ ptr
1= mcstrdup(child, ptr
);
printf("mixed:%s free:%d freechild:%d\n", ptr1, base->chunk->freesize, child->chunk->freesize);
freeMemoryContext(child);
printf("mixed:%s free:%d freechild:%d\n", ptr1, base->chunk->freesize, child->chunk->freesize);
freeMemoryContext(child);
diff --git
a/tbtree.c
b/tbtree.c
index
e075b0a
..
af12db5
100644
(file)
--- a/
tbtree.c
+++ b/
tbtree.c
@@
-208,7
+208,7
@@
findInCache(TBTree *db, u_int32_t pagenumber) {
while(ptr && ptr->pagenumber != pagenumber)
ptr = ptr->link;
while(ptr && ptr->pagenumber != pagenumber)
ptr = ptr->link;
- return ptr;
;
+ return ptr;
}
static void
}
static void
diff --git
a/tmalloc.c
b/tmalloc.c
index
d6c0b76
..
fee18cb
100644
(file)
--- a/
tmalloc.c
+++ b/
tmalloc.c
@@
-228,6
+228,9
@@
mcrealloc(void * ptr, size_t size) {
/* just enlarge */
alloc->cntx->chunk->freesize -= PTRALIGN(size)-realsize;
alloc->size+=PTRALIGN(size)-realsize;
/* just enlarge */
alloc->cntx->chunk->freesize -= PTRALIGN(size)-realsize;
alloc->size+=PTRALIGN(size)-realsize;
+ memmove( ((char*)alloc) - (PTRALIGN(size)-realsize), alloc, PTRALIGN(size)+MCASHDRSZ );
+ alloc = (MCAllocatedSpace*) ( ((char*)alloc) - (PTRALIGN(size)-realsize) );
+ ptr = (void*)alloc->data;
if ( alloc->cntx->flags & MC_DEBUG ) {
memset( (char*)(alloc->data) + realsize, 0xc3, PTRALIGN(size)-realsize );
*(u_int32_t*)((char*)alloc + alloc->size - sizeof(u_int32_t) ) = MCMAGICKNUMBER;
if ( alloc->cntx->flags & MC_DEBUG ) {
memset( (char*)(alloc->data) + realsize, 0xc3, PTRALIGN(size)-realsize );
*(u_int32_t*)((char*)alloc + alloc->size - sizeof(u_int32_t) ) = MCMAGICKNUMBER;