From 494ed1cef2b0911d25d9727a026371d9d60d1cd1 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 5 Jul 2020 15:51:36 -0700 Subject: [PATCH] remove unused vmsize API --- lib/vmalloc/vmalloc.h | 3 --- lib/vmalloc/vmbest.c | 45 ------------------------------------------- 2 files changed, 48 deletions(-) diff --git a/lib/vmalloc/vmalloc.h b/lib/vmalloc/vmalloc.h index 9ac766fbc..686930d0d 100644 --- a/lib/vmalloc/vmalloc.h +++ b/lib/vmalloc/vmalloc.h @@ -62,7 +62,6 @@ extern "C" { void *(*resizef) (Vmalloc_t *, void *, size_t, int); int (*freef) (Vmalloc_t *, void *); long (*addrf) (Vmalloc_t *, void *); - long (*sizef) (Vmalloc_t *, void *); unsigned short meth; }; @@ -117,7 +116,6 @@ extern "C" { extern int vmfree(Vmalloc_t *, void *); extern long vmaddr(Vmalloc_t *, void *); - extern long vmsize(Vmalloc_t *, void *); extern Vmalloc_t *vmregion(void *); extern int vmset(Vmalloc_t *, int, int); @@ -152,7 +150,6 @@ extern "C" { #define vmfree(vm,d) (*(_VM_(vm)->meth.freef))((vm),(void*)(d)) #endif #define vmaddr(vm,addr) (*(_VM_(vm)->meth.addrf))((vm),(void*)(addr)) -#define vmsize(vm,addr) (*(_VM_(vm)->meth.sizef))((vm),(void*)(addr)) #define vmoldof(v,p,t,n,x) (t*)vmresize((v), (p), sizeof(t)*(n)+(x), \ (VM_RSMOVE) ) #define vmnewof(v,p,t,n,x) (t*)vmresize((v), (p), sizeof(t)*(n)+(x), \ diff --git a/lib/vmalloc/vmbest.c b/lib/vmalloc/vmbest.c index 2dbc298d9..5ff9c99d7 100644 --- a/lib/vmalloc/vmbest.c +++ b/lib/vmalloc/vmbest.c @@ -881,49 +881,6 @@ static void *bestresize(Vmalloc_t * vm, void * data, reg size_t size, return data; } -/** - * @param vm region allocating from - * @param addr address to check - */ -static long bestsize(Vmalloc_t * vm, void * addr) -{ - reg Seg_t *seg; - reg Block_t *b, *endb; - reg long size; - reg Vmdata_t *vd = vm->data; - - if (!(vd->mode & VM_TRUST)) { - if (ISLOCK(vd, 0)) - return -1L; - SETLOCK(vd, 0); - } - - size = -1L; - for (seg = vd->seg; seg; seg = seg->next) { - b = SEGBLOCK(seg); - endb = (Block_t *) (seg->baddr - sizeof(Head_t)); - if ((Vmuchar_t *) addr <= (Vmuchar_t *) b || - (Vmuchar_t *) addr >= (Vmuchar_t *) endb) - continue; - while (b < endb) { - if (addr == DATA(b)) { - if (!ISBUSY(SIZE(b)) || ISJUNK(SIZE(b))) - size = -1L; - else - size = (long) SIZE(b) & ~BITS; - goto done; - } else if ((Vmuchar_t *) addr <= (Vmuchar_t *) b) - break; - - b = (Block_t *) ((Vmuchar_t *) DATA(b) + (SIZE(b) & ~BITS)); - } - } - - done: - CLRLOCK(vd, 0); - return size; -} - /* A discipline to get memory using sbrk() or VirtualAlloc on win32 */ /** * @param vm region doing allocation from @@ -987,7 +944,6 @@ static Vmethod_t _Vmbest = { bestresize, bestfree, bestaddr, - bestsize, VM_MTBEST }; @@ -1006,7 +962,6 @@ static Vmalloc_t _Vmheap = { bestresize, bestfree, bestaddr, - bestsize, VM_MTBEST}, NIL(char *), /* file */ 0, /* line */ -- 2.40.0