From: Erwin Janssen Date: Mon, 26 Sep 2016 20:27:09 +0000 (+0200) Subject: Remove usage of not set define HAVE_VMALLOC X-Git-Tag: untagged-5fc0363bc76319758ff6~1^2^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab00f27f10dfc18359b7780415ecf4cdd9777e37;p=graphviz Remove usage of not set define HAVE_VMALLOC This define is only used three times in lib/cgraph: - In cghdr.h to include vmalloc.h - In main.c in a function that is never called. - in mem.c where malloc based allocation is used instead. --- diff --git a/lib/cgraph/cghdr.h b/lib/cgraph/cghdr.h index ab1195a92..4a0d6729c 100644 --- a/lib/cgraph/cghdr.h +++ b/lib/cgraph/cghdr.h @@ -24,10 +24,6 @@ #include #include - -#ifdef HAVE_VMALLOC -#include -#endif /* HAVE_VMALLOC */ #include #include #include diff --git a/lib/cgraph/main.c b/lib/cgraph/main.c index 44bc8073a..82455b268 100644 --- a/lib/cgraph/main.c +++ b/lib/cgraph/main.c @@ -14,10 +14,6 @@ #include #include -static void prstats(Agraph_t * g, int verbose); -static void do_it(Agraph_t * g, int dostat); - - static void my_ins(Agraph_t * g, Agobj_t * obj, void *context) { Agnode_t *n; @@ -44,35 +40,9 @@ main(int argc, char **argv) prev = agopen("some_name", Agdirected, NIL(Agdisc_t *)); agcallbacks(prev, FALSE); agpushdisc(prev, &mydisc, NIL(void *)); - while (g = agconcat(prev, stdin, NIL(Agdisc_t *))) { - /*do_it(g, dostat); */ - } /*agwrite(prev,stdout); */ fprintf(stderr, "ready to go, computer fans\n"); agcallbacks(prev, TRUE); agclose(prev); return 1; } - -static void prstats(Agraph_t * g, int verbose) -{ -#ifdef HAVE_VMALLOC - Vmstat_t ss, *s; - vmstat(g->cmn->heap, &ss); - s = &ss; - if (verbose) - fprintf(stderr, - "n_busy %d n_free %d s_busy %d s_free %d m_busy %d m_free %d n_seg %d extent %d\n", - s->n_busy, s->n_free, s->s_busy, s->s_free, s->m_busy, - s->m_free, s->n_seg, s->extent); - else - fprintf(stderr, "%d (%d,%d)\n", s->extent, s->s_busy, s->s_free); -#endif -} - -static void do_it(Agraph_t * g, int dostat) -{ - agwrite(g, stdout); - if (dostat) - prstats(g, dostat > 1); -} diff --git a/lib/cgraph/mem.c b/lib/cgraph/mem.c index 16f2a92a8..8d9331920 100644 --- a/lib/cgraph/mem.c +++ b/lib/cgraph/mem.c @@ -14,54 +14,6 @@ #include /* memory management discipline and entry points */ - -#if defined(HAVE_VMALLOC) - - /* vmalloc based allocator */ -static void *memopen(void) -{ -#if defined(DEBUG) || defined(MEMDEBUG) - return vmopen(Vmdcheap, Vmdebug, - VM_MTDEBUG | VM_DBCHECK | VM_DBABORT | VM_TRACE); -#else - return vmopen(Vmdcheap, Vmbest, VM_MTBEST); -#endif -} - -static void *memalloc(void *heap, size_t request) -{ - void *rv; - rv = vmalloc((Vmalloc_t *) heap, request); - if (rv) memset(rv, 0, request); - return rv; -} - -static void *memresize(void *heap, void *ptr, size_t oldsize, - size_t request) -{ - void *rv; - - rv = vmresize((Vmalloc_t *) heap, ptr, request, VM_RSCOPY | VM_RSZERO); - return rv; -} - -static void memfree(void *heap, void *ptr) -{ - vmfree((Vmalloc_t *) heap, ptr); -} - -static void memclose(void *heap) -{ - vmclose((Vmalloc_t *) heap); -} - -Agmemdisc_t AgMemDisc = - { memopen, memalloc, memresize, memfree, memclose }; - -#else - - /* malloc based allocator */ - static void *memopen(Agdisc_t* disc) { return NIL(void *); @@ -107,9 +59,6 @@ static void memclose(void *heap) Agmemdisc_t AgMemDisc = { memopen, memalloc, memresize, memfree, memclose }; -#endif - - void *agalloc(Agraph_t * g, size_t size) { void *mem;