]> granicus.if.org Git - graphviz/commitdiff
Removed old-style function defintions from vmalloc
authorErwin Janssen <erwinjanssen@outlook.com>
Wed, 14 Sep 2016 15:16:24 +0000 (17:16 +0200)
committerErwin Janssen <erwinjanssen@outlook.com>
Mon, 19 Sep 2016 12:50:28 +0000 (14:50 +0200)
The functions definitions in vmalloc are all surrounded by an `#if __STD_C`, if __STD_C is not defined than the old style function definition is used. These days STD C is the standard and the old style function defintions are obsolete.
They have been removed from lib/vmalloc and its subprojects, comments have been preserved by converting them to a Doxygen style.

19 files changed:
lib/vmalloc/malloc.c
lib/vmalloc/vmbest.c
lib/vmalloc/vmclear.c
lib/vmalloc/vmclose.c
lib/vmalloc/vmdcheap.c
lib/vmalloc/vmdebug.c
lib/vmalloc/vmdisc.c
lib/vmalloc/vmexit.c
lib/vmalloc/vmlast.c
lib/vmalloc/vmopen.c
lib/vmalloc/vmpool.c
lib/vmalloc/vmprivate.c
lib/vmalloc/vmprofile.c
lib/vmalloc/vmregion.c
lib/vmalloc/vmsegment.c
lib/vmalloc/vmset.c
lib/vmalloc/vmstat.c
lib/vmalloc/vmtrace.c
lib/vmalloc/vmwalk.c

index 018e569df81d51d9179c0abfae9955e054b7fd6d..d535d66b3deba64095cf3031c8c5628ddfbdb622 100644 (file)
@@ -55,12 +55,7 @@ int _STUB_malloc;
 #undef memalign
 #undef valloc
 
-#if __STD_C
 static Vmulong_t atou(char **sp)
-#else
-static Vmulong_t atou(sp)
-char **sp;
-#endif
 {
     char *s = *sp;
     Vmulong_t v = 0;
@@ -100,13 +95,7 @@ static int _Vmpffd = -1;
                vmdbcheck(Vmregion); \
        }
 
-#if __STD_C
 static char *insertpid(char *begs, char *ends)
-#else
-static char *insertpid(begs, ends)
-char *begs;
-char *ends;
-#endif
 {
     int pid;
     char *s;
@@ -126,12 +115,7 @@ char *ends;
     return begs;
 }
 
-#if __STD_C
 static int createfile(char *file)
-#else
-static int createfile(file)
-char *file;
-#endif
 {
     char buf[1024];
     char *next, *endb;
@@ -166,21 +150,13 @@ char *file;
 #endif
 }
 
-#if __STD_C
 static void pfprint(void)
-#else
-static void pfprint()
-#endif
 {
     if (Vmregion->meth.meth == VM_MTPROFILE)
        vmprofile(Vmregion, _Vmpffd);
 }
 
-#if __STD_C
 static int vmflinit(void)
-#else
-static int vmflinit()
-#endif
 {
     char *env;
     Vmalloc_t *vm;
@@ -268,83 +244,49 @@ static int vmflinit()
     return 0;
 }
 
-#if __STD_C
 Void_t *malloc(reg size_t size)
-#else
-Void_t *malloc(size)
-reg size_t size;
-#endif
 {
     VMFLINIT();
     return (*Vmregion->meth.allocf) (Vmregion, size);
 }
 
-#if __STD_C
+/**
+ * @param data block to be reallocated
+ * @param size new size
+ */
 Void_t *realloc(reg Void_t * data, reg size_t size)
-#else
-Void_t *realloc(data, size)
-reg Void_t *data;              /* block to be reallocated      */
-reg size_t size;               /* new size                     */
-#endif
 {
     VMFLINIT();
     return (*Vmregion->meth.resizef) (Vmregion, data, size,
                                      VM_RSCOPY | VM_RSMOVE);
 }
 
-#if __STD_C
 void free(reg Void_t * data)
-#else
-void free(data)
-reg Void_t *data;
-#endif
 {
     VMFLINIT();
     (void) (*Vmregion->meth.freef) (Vmregion, data);
 }
 
-#if __STD_C
 Void_t *calloc(reg size_t n_obj, reg size_t s_obj)
-#else
-Void_t *calloc(n_obj, s_obj)
-reg size_t n_obj;
-reg size_t s_obj;
-#endif
 {
     VMFLINIT();
     return (*Vmregion->meth.resizef) (Vmregion, NIL(Void_t *),
                                      n_obj * s_obj, VM_RSZERO);
 }
 
-#if __STD_C
 void cfree(reg Void_t * data)
-#else
-void cfree(data)
-reg Void_t *data;
-#endif
 {
     VMFLINIT();
     (void) (*Vmregion->meth.freef) (Vmregion, data);
 }
 
-#if __STD_C
 Void_t *memalign(reg size_t align, reg size_t size)
-#else
-Void_t *memalign(align, size)
-reg size_t align;
-reg size_t size;
-#endif
 {
     VMFLINIT();
     return (*Vmregion->meth.alignf) (Vmregion, size, align);
 }
 
-#if __STD_C
 Void_t *valloc(reg size_t size)
-#else
-Void_t *valloc(size)
-reg size_t size;
-#endif
 {
     VMFLINIT();
     GETPAGESIZE(_Vmpagesize);
@@ -364,13 +306,7 @@ reg size_t size;
 #undef alloca
 
 #if _lib_mallopt
-#if __STD_C
 int mallopt(int cmd, int value)
-#else
-int mallopt(cmd, value)
-int cmd;
-int value;
-#endif
 {
     VMFLINIT();
     return 0;
@@ -378,11 +314,7 @@ int value;
 #endif
 
 #if _lib_mallinfo
-#if __STD_C
 struct mallinfo mallinfo(void)
-#else
-struct mallinfo mallinfo()
-#endif
 {
     Vmstat_t sb;
     struct mallinfo mi;
@@ -400,11 +332,7 @@ struct mallinfo mallinfo()
 #endif
 
 #if _lib_mstats
-#if __STD_C
 struct mstats mstats(void)
-#else
-struct mstats mstats()
-#endif
 {
     Vmstat_t sb;
     struct mstats ms;
@@ -441,12 +369,7 @@ struct _alloca_s {
     Vmuchar_t data[1];
 };
 
-#if __STD_C
 Void_t *alloca(size_t size)
-#else
-Void_t *alloca(size)
-size_t size;
-#endif
 {
     char array[ALIGN];
     char *file;
index 608a713195ccf5bb00f8cb99bc39a236e1796804..7cff84123a2155fd2391c1803ee1c1a7de4fd676 100644 (file)
@@ -43,13 +43,7 @@ static size_t S_junk;                /* total junk space                     */
 static int Vmcheck = 0;                /* 1 if checking                        */
 
 /* Check to see if a block is in the free tree */
-#if __STD_C
 static int vmintree(Block_t * node, Block_t * b)
-#else
-static int vmintree(node, b)
-Block_t *node;
-Block_t *b;
-#endif
 {
     Block_t *t;
 
@@ -64,13 +58,7 @@ Block_t *b;
 }
 
 /* Check to see if a block is known to be free */
-#if __STD_C
 static int vmisfree(Vmdata_t * vd, Block_t * b)
-#else
-static int vmisfree(vd, b)
-Vmdata_t *vd;
-Block_t *b;
-#endif
 {
     Block_t *t;
     size_t s;
@@ -88,12 +76,7 @@ Block_t *b;
 }
 
 /* check to see if the tree is in good shape */
-#if __STD_C
 static int vmchktree(Block_t * node)
-#else
-static int vmchktree(node)
-Block_t *node;
-#endif
 {
     Block_t *t;
 
@@ -114,13 +97,7 @@ Block_t *node;
     return 1;
 }
 
-#if __STD_C
 static int vmonlist(Block_t * list, Block_t * b)
-#else
-static int vmonlist(list, b)
-Block_t *list;
-Block_t *b;
-#endif
 {
     for (; list; list = LINK(list))
        if (list == b)
@@ -128,14 +105,12 @@ Block_t *b;
     return 0;
 }
 
-#if __STD_C
+/**
+ * @param vd
+ * @param size if > 0, checking that no large free block >size
+ * @param wild if != 0, do above but allow wild to be >size
+ */
 static int vmcheck(Vmdata_t * vd, size_t size, int wild)
-#else
-static int vmcheck(vd, size, wild)
-Vmdata_t *vd;
-size_t size;                   /* if > 0, checking that no large free block >size      */
-int wild;                      /* if != 0, do above but allow wild to be >size         */
-#endif
 {
     reg Seg_t *seg;
     reg Block_t *b, *endb, *t, *np;
@@ -226,15 +201,8 @@ int wild;                  /* if != 0, do above but allow wild to be >size         */
 #define RLINK(s,x)     ((s) = LEFT(s) = (x))
 #define LLINK(s,x)     ((s) = RIGHT(s) = (x))
 /* Find and delete a suitable element in the free tree. */
-#if __STD_C
 static Block_t *bestsearch(Vmdata_t * vd, reg size_t size,
                           Block_t * wanted)
-#else
-static Block_t *bestsearch(vd, size, wanted)
-Vmdata_t *vd;
-reg size_t size;
-Block_t *wanted;
-#endif
 {
     reg size_t s;
     reg Block_t *t, *root, *l, *r;
@@ -339,14 +307,7 @@ Block_t *wanted;
 }
 
 /* Reclaim all delayed free blocks into the free tree */
-#if __STD_C
 static int bestreclaim(reg Vmdata_t * vd, Block_t * wanted, int c)
-#else
-static int bestreclaim(vd, wanted, c)
-reg Vmdata_t *vd;
-Block_t *wanted;
-int c;
-#endif
 {
     reg size_t size, s;
     reg Block_t *fp, *np, *t, *list, **cache;
@@ -520,13 +481,11 @@ int c;
     return count;
 }
 
-#if __STD_C
+/**
+ * @param vm region allocating from
+ * @param size desired block size
+ */
 static Void_t *bestalloc(Vmalloc_t * vm, reg size_t size)
-#else
-static Void_t *bestalloc(vm, size)
-Vmalloc_t *vm;                 /* region allocating from       */
-reg size_t size;               /* desired block size           */
-#endif
 {
     reg Vmdata_t *vd = vm->data;
     reg size_t s;
@@ -664,13 +623,11 @@ reg size_t size;          /* desired block size           */
     return DATA(tp);
 }
 
-#if __STD_C
+/**
+ * @param vm region allocating from
+ * @param addr address to check
+ */
 static long bestaddr(Vmalloc_t * vm, Void_t * addr)
-#else
-static long bestaddr(vm, addr)
-Vmalloc_t *vm;                 /* region allocating from       */
-Void_t *addr;                  /* address to check             */
-#endif
 {
     reg Seg_t *seg;
     reg Block_t *b, *endb;
@@ -725,13 +682,7 @@ Void_t *addr;                      /* address to check             */
     return offset;
 }
 
-#if __STD_C
 static int bestfree(Vmalloc_t * vm, Void_t * data)
-#else
-static int bestfree(vm, data)
-Vmalloc_t *vm;
-Void_t *data;
-#endif
 {
     reg Vmdata_t *vd = vm->data;
     reg Block_t *bp, **cache;
@@ -781,16 +732,14 @@ Void_t *data;
     return 0;
 }
 
-#if __STD_C
+/**
+ * @param vm region allocation from
+ * @param data old block of data
+ * @param size new size
+ * @param type !=0 to move, <0 for not copy
+ */
 static Void_t *bestresize(Vmalloc_t * vm, Void_t * data, reg size_t size,
                          int type)
-#else
-static Void_t *bestresize(vm, data, size, type)
-Vmalloc_t *vm;                 /* region allocating from       */
-Void_t *data;                  /* old block of data            */
-reg size_t size;               /* new size                     */
-int type;                      /* !=0 to move, <0 for not copy */
-#endif
 {
     reg Vmdata_t *vd = vm->data;
     reg Block_t *rp, *np, *t, **cache;
@@ -932,13 +881,11 @@ int type;                 /* !=0 to move, <0 for not copy */
     return data;
 }
 
-#if __STD_C
+/**
+ * @param vm region allocating from
+ * @param addr address to check
+ */
 static long bestsize(Vmalloc_t * vm, Void_t * addr)
-#else
-static long bestsize(vm, addr)
-Vmalloc_t *vm;                 /* region allocating from       */
-Void_t *addr;                  /* address to check             */
-#endif
 {
     reg Seg_t *seg;
     reg Block_t *b, *endb;
@@ -977,12 +924,7 @@ Void_t *addr;                      /* address to check             */
     return size;
 }
 
-#if __STD_C
 static int bestcompact(Vmalloc_t * vm)
-#else
-static int bestcompact(vm)
-Vmalloc_t *vm;
-#endif
 {
     reg Seg_t *seg, *next;
     reg Block_t *bp, *t;
@@ -1049,14 +991,7 @@ Vmalloc_t *vm;
     return 0;
 }
 
-#if __STD_C
 static Void_t *bestalign(Vmalloc_t * vm, size_t size, size_t align)
-#else
-static Void_t *bestalign(vm, size, align)
-Vmalloc_t *vm;
-size_t size;
-size_t align;
-#endif
 {
     reg Vmuchar_t *data;
     reg Block_t *tp, *np;
@@ -1150,17 +1085,15 @@ size_t align;
 }
 
 /*     A discipline to get memory using sbrk() or VirtualAlloc on win32 */
-#if __STD_C
+/**
+ * @param vm region doing allocation from
+ * @param caddr current address
+ * @param csize current size
+ * @param nsize new size
+ * @param disc discipline structure
+ */
 static Void_t *sbrkmem(Vmalloc_t * vm, Void_t * caddr,
                       size_t csize, size_t nsize, Vmdisc_t * disc)
-#else
-static Void_t *sbrkmem(vm, caddr, csize, nsize, disc)
-Vmalloc_t *vm;                 /* region doing allocation from         */
-Void_t *caddr;                 /* current address                      */
-size_t csize;                  /* current size                         */
-size_t nsize;                  /* new size                             */
-Vmdisc_t *disc;                        /* discipline structure                 */
-#endif
 {
 #if _std_malloc || _BLD_INSTRUMENT || cray
     NOTUSED(vm);
index 0791a793a4cb192461cf06d311774365841d641b..cc9d9e51e8d7755079957a6d8c7a5696d5c1ae91 100644 (file)
 **
 **     Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
 */
-#if __STD_C
 int vmclear(Vmalloc_t * vm)
-#else
-int vmclear(vm)
-Vmalloc_t *vm;
-#endif
 {
     reg Seg_t *seg;
     reg Seg_t *next;
index 5afec39587e48cdf53e8977abff7d81332fdb321..673dc805e7ccb4159b5c2a5b0bbce0a4f676f53a 100644 (file)
 **
 **     Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
 */
-#if __STD_C
 int vmclose(Vmalloc_t * vm)
-#else
-int vmclose(vm)
-Vmalloc_t *vm;
-#endif
 {
     reg Seg_t *seg, *vmseg;
     reg Vmemory_f memoryf;
index 1891a3b98796798ae36a7ebf7540b15694ed966b..6967999a0c632f764ebf9a2116eaf61384dc7d88 100644 (file)
 **
 **     Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
 */
-#if __STD_C
+/**
+ * @param vm region doing allocation from
+ * @param caddr current low address
+ * @param csize current size
+ * @param nsize new size
+ * @param disc discipline structure
+ */
 static Void_t *heapmem(Vmalloc_t * vm, Void_t * caddr,
                       size_t csize, size_t nsize, Vmdisc_t * disc)
-#else
-static Void_t *heapmem(vm, caddr, csize, nsize, disc)
-Vmalloc_t *vm;                 /* region doing allocation from         */
-Void_t *caddr;                 /* current low address                  */
-size_t csize;                  /* current size                         */
-size_t nsize;                  /* new size                             */
-Vmdisc_t *disc;                        /* discipline structure                 */
-#endif
 {
     NOTUSED(vm);
     NOTUSED(disc);
index 533f39639fd23becd307bdb24dca1641f5f746e7..b8e0f11c3d4549357fedc8374610261d7aab0dee 100644 (file)
@@ -63,14 +63,7 @@ static void dbinit(void)
 }
 
 /* just an entry point to make it easy to set break point */
-#if __STD_C
 static void vmdbwarn(Vmalloc_t * vm, char *mesg, int n)
-#else
-static void vmdbwarn(vm, mesg, n)
-Vmalloc_t *vm;
-char *mesg;
-int n;
-#endif
 {
     reg Vmdata_t *vd = vm->data;
 
@@ -80,18 +73,16 @@ int n;
 }
 
 /* issue a warning of some type */
-#if __STD_C
+/**
+ * @param vm region holding the block
+ * @param data data block
+ * @param where byte that was corrupted
+ * @param file file where call originates
+ * @param line line number of call
+ * @param type operation being done
+ */
 static void dbwarn(Vmalloc_t * vm, Void_t * data, int where, char *file,
                   int line, int type)
-#else
-static void dbwarn(vm, data, where, file, line, type)
-Vmalloc_t *vm;                 /* region holding the block     */
-Void_t *data;                  /* data block                   */
-int where;                     /* byte that was corrupted      */
-char *file;                    /* file where call originates   */
-int line;                      /* line number of call          */
-int type;                      /* operation being done         */
-#endif
 {
     char buf[1024], *bufp, *endbuf, *s;
 #define SLOP   64              /* enough for a message and an int */
@@ -177,17 +168,8 @@ int type;                  /* operation being done         */
 }
 
 /* check for watched address and issue warnings */
-#if __STD_C
 static void dbwatch(Vmalloc_t * vm, Void_t * data, char *file, int line,
                    int type)
-#else
-static void dbwatch(vm, data, file, line, type)
-Vmalloc_t *vm;
-Void_t *data;
-char *file;
-int line;
-int type;
-#endif
 {
     reg int n;
 
@@ -200,15 +182,13 @@ int type;
 }
 
 /* record information about the block */
-#if __STD_C
+/**
+ * @param data real address not the one from Vmbest
+ * @param size the actual requested size
+ * @param file file where the request came from
+ * @param line and line number
+ */
 static void dbsetinfo(Vmuchar_t * data, size_t size, char *file, int line)
-#else
-static void dbsetinfo(data, size, file, line)
-Vmuchar_t *data;               /* real address not the one from Vmbest */
-size_t size;                   /* the actual requested size            */
-char *file;                    /* file where the request came from     */
-int line;                      /* and line number                      */
-#endif
 {
     reg Vmuchar_t *begp, *endp;
     reg Dbfile_t *last, *db;
@@ -254,13 +234,7 @@ int line;                  /* and line number                      */
 ** This returns -(offset+1) if block is already freed, +(offset+1)
 ** if block is live, 0 if no match.
 */
-#if __STD_C
 static long dbaddr(Vmalloc_t * vm, Void_t * addr)
-#else
-static long dbaddr(vm, addr)
-Vmalloc_t *vm;
-Void_t *addr;
-#endif
 {
     reg Block_t *b = NULL, *endb = NULL;
     reg Seg_t *seg;
@@ -317,13 +291,7 @@ Void_t *addr;
 }
 
 
-#if __STD_C
 static long dbsize(Vmalloc_t * vm, Void_t * addr)
-#else
-static long dbsize(vm, addr)
-Vmalloc_t *vm;
-Void_t *addr;
-#endif
 {
     reg Block_t *b, *endb;
     reg Seg_t *seg;
@@ -356,13 +324,7 @@ Void_t *addr;
     return size;
 }
 
-#if __STD_C
 static Void_t *dballoc(Vmalloc_t * vm, size_t size)
-#else
-static Void_t *dballoc(vm, size)
-Vmalloc_t *vm;
-size_t size;
-#endif
 {
     reg size_t s;
     reg Vmuchar_t *data;
@@ -408,13 +370,7 @@ size_t size;
 }
 
 
-#if __STD_C
 static int dbfree(Vmalloc_t * vm, Void_t * data)
-#else
-static int dbfree(vm, data)
-Vmalloc_t *vm;
-Void_t *data;
-#endif
 {
     char *file;
     int line;
@@ -466,16 +422,14 @@ Void_t *data;
 }
 
 /*     Resizing an existing block */
-#if __STD_C
+/**
+ * @param vm region allocating from
+ * @param addr old block of data
+ * @param size new size
+ * @param type !=0 for movable, >0 for copy
+ */
 static Void_t *dbresize(Vmalloc_t * vm, Void_t * addr, reg size_t size,
                        int type)
-#else
-static Void_t *dbresize(vm, addr, size, type)
-Vmalloc_t *vm;                 /* region allocating from       */
-Void_t *addr;                  /* old block of data            */
-reg size_t size;               /* new size                     */
-int type;                      /* !=0 for movable, >0 for copy */
-#endif
 {
     reg Vmuchar_t *data;
     reg size_t s, oldsize;
@@ -558,23 +512,13 @@ int type;                 /* !=0 for movable, >0 for copy */
 }
 
 /* compact any residual free space */
-#if __STD_C
 static int dbcompact(Vmalloc_t * vm)
-#else
-static int dbcompact(vm)
-Vmalloc_t *vm;
-#endif
 {
     return (*(Vmbest->compactf)) (vm);
 }
 
 /* check for memory overwrites over all live blocks */
-#if __STD_C
 int vmdbcheck(Vmalloc_t * vm)
-#else
-int vmdbcheck(vm)
-Vmalloc_t *vm;
-#endif
 {
     reg Block_t *b, *endb;
     reg Seg_t *seg;
@@ -625,12 +569,12 @@ Vmalloc_t *vm;
 }
 
 /* set/delete an address to watch */
-#if __STD_C
+/**
+ * set/delete an address to watch
+ *
+ * @param addr address to insert
+ */
 Void_t *vmdbwatch(Void_t * addr)
-#else
-Void_t *vmdbwatch(addr)
-Void_t *addr;                  /* address to insert                    */
-#endif
 {
     reg int n;
     reg Void_t *out;
@@ -656,14 +600,7 @@ Void_t *addr;                      /* address to insert                    */
     return out;
 }
 
-#if __STD_C
 static Void_t *dbalign(Vmalloc_t * vm, size_t size, size_t align)
-#else
-static Void_t *dbalign(vm, size, align)
-Vmalloc_t *vm;
-size_t size;
-size_t align;
-#endif
 {
     reg Vmuchar_t *data;
     reg size_t s;
index 1d3d154a9e1536e990ca369f5dd9d01adcda420a..adfcd2fc71869f1dd03e9bf535feb6139a1cc60a 100644 (file)
 **
 **     Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
 */
-#if __STD_C
 Vmdisc_t *vmdisc(Vmalloc_t * vm, Vmdisc_t * disc)
-#else
-Vmdisc_t *vmdisc(vm, disc)
-Vmalloc_t *vm;
-Vmdisc_t *disc;
-#endif
 {
     Vmdisc_t *old = vm->disc;
 
index 0861dcfe260422c89802e0657e74548fc47b9e88..b63b1f8d48f5d9b03f8e5ad979a28ea8a07e139d 100644 (file)
@@ -23,12 +23,7 @@ int Vm_atexit_already_defined;
 
 #if _lib_onexit
 
-#if __STD_C
 int atexit(void (*exitf) (void))
-#else
-int atexit(exitf)
-void (*exitf) ();
-#endif
 {
     return onexit(exitf);
 }
@@ -41,12 +36,7 @@ typedef struct _exit_s {
 } Exit_t;
 static Exit_t *Exit;
 
-#if __STD_C
 atexit(void (*exitf) (void))
-#else
-atexit(exitf)
-void (*exitf) ();
-#endif
 {
     Exit_t *e;
 
@@ -58,12 +48,7 @@ void (*exitf) ();
     return 0;
 }
 
-#if __STD_C
 void exit(int type)
-#else
-void exit(type)
-int type;
-#endif
 {
     Exit_t *e;
 
index 3232225be2d49ab48b83c517cc5e002c80f2965a..bd6b376e84710189319f3756f6ebee4a0e0c6cb1 100644 (file)
 **     Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
 */
 
-#if __STD_C
 static Void_t *lastalloc(Vmalloc_t * vm, size_t size)
-#else
-static Void_t *lastalloc(vm, size)
-Vmalloc_t *vm;
-size_t size;
-#endif
 {
     reg Block_t *tp, *next;
     reg Seg_t *seg, *last;
@@ -84,13 +78,7 @@ size_t size;
     return (Void_t *) tp;
 }
 
-#if __STD_C
 static int lastfree(Vmalloc_t * vm, reg Void_t * data)
-#else
-static int lastfree(vm, data)
-Vmalloc_t *vm;
-reg Void_t *data;
-#endif
 {
     reg Seg_t *seg;
     reg Block_t *fp;
@@ -134,16 +122,8 @@ reg Void_t *data;
     return 0;
 }
 
-#if __STD_C
 static Void_t *lastresize(Vmalloc_t * vm, reg Void_t * data, size_t size,
                          int type)
-#else
-static Void_t *lastresize(vm, data, size, type)
-Vmalloc_t *vm;
-reg Void_t *data;
-size_t size;
-int type;
-#endif
 {
     reg Block_t *tp;
     reg Seg_t *seg;
@@ -281,13 +261,7 @@ int type;
 }
 
 
-#if __STD_C
 static long lastaddr(Vmalloc_t * vm, Void_t * addr)
-#else
-static long lastaddr(vm, addr)
-Vmalloc_t *vm;
-Void_t *addr;
-#endif
 {
     reg Vmdata_t *vd = vm->data;
 
@@ -300,13 +274,7 @@ Void_t *addr;
        return (Vmuchar_t *) addr - (Vmuchar_t *) vd->free;
 }
 
-#if __STD_C
 static long lastsize(Vmalloc_t * vm, Void_t * addr)
-#else
-static long lastsize(vm, addr)
-Vmalloc_t *vm;
-Void_t *addr;
-#endif
 {
     reg Vmdata_t *vd = vm->data;
 
@@ -321,12 +289,7 @@ Void_t *addr;
            sizeof(Head_t);
 }
 
-#if __STD_C
 static int lastcompact(Vmalloc_t * vm)
-#else
-static int lastcompact(vm)
-Vmalloc_t *vm;
-#endif
 {
     reg Block_t *fp;
     reg Seg_t *seg, *next;
@@ -362,14 +325,7 @@ Vmalloc_t *vm;
     return 0;
 }
 
-#if __STD_C
 static Void_t *lastalign(Vmalloc_t * vm, size_t size, size_t align)
-#else
-static Void_t *lastalign(vm, size, align)
-Vmalloc_t *vm;
-size_t size;
-size_t align;
-#endif
 {
     reg Vmuchar_t *data;
     reg size_t s, orgsize = 0, orgalign = 0;
index 81b162ab2800b9dcce97188dcf2232b0f9012477..bec6f1f711b7a320758f8aa372a2ac71390a2d46 100644 (file)
@@ -29,14 +29,12 @@ typedef struct _vminit_ {
     char a[3 * ALIGN];         /* extra to fuss with alignment */
 } Vminit_t;
 
-#if __STD_C
+/**
+ * @param disc discipline to get segments
+ * @param meth method to manage space
+ * @param mode type of region
+ */
 Vmalloc_t *vmopen(Vmdisc_t * disc, Vmethod_t * meth, int mode)
-#else
-Vmalloc_t *vmopen(disc, meth, mode)
-Vmdisc_t *disc;                        /* discipline to get segments   */
-Vmethod_t *meth;               /* method to manage space       */
-int mode;                      /* type of region               */
-#endif
 {
     reg Vmalloc_t *vm;
     reg Vmdata_t *vd;
index 8021fc2e3768b08e8ed7cd3dd4532ab44bbfa411..133e57212adee3e45fd41b7423c91318081fa63e 100644 (file)
 **     Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
 */
 
-#if __STD_C
 static Void_t *poolalloc(Vmalloc_t * vm, reg size_t size)
-#else
-static Void_t *poolalloc(vm, size)
-Vmalloc_t *vm;
-reg size_t size;
-#endif
 {
     reg Vmdata_t *vd = vm->data;
     reg Block_t *tp, *next;
@@ -103,13 +97,7 @@ reg size_t size;
     return (Void_t *) tp;
 }
 
-#if __STD_C
 static long pooladdr(Vmalloc_t * vm, reg Void_t * addr)
-#else
-static long pooladdr(vm, addr)
-Vmalloc_t *vm;
-reg Void_t *addr;
-#endif
 {
     reg Block_t *bp, *tp;
     reg Vmuchar_t *laddr, *baddr;
@@ -153,13 +141,7 @@ reg Void_t *addr;
     return offset;
 }
 
-#if __STD_C
 static int poolfree(reg Vmalloc_t * vm, reg Void_t * data)
-#else
-static int poolfree(vm, data)
-reg Vmalloc_t *vm;
-reg Void_t *data;
-#endif
 {
     reg Block_t *bp;
     reg Vmdata_t *vd = vm->data;
@@ -195,16 +177,8 @@ reg Void_t *data;
     return 0;
 }
 
-#if __STD_C
 static Void_t *poolresize(Vmalloc_t * vm, Void_t * data, size_t size,
                          int type)
-#else
-static Void_t *poolresize(vm, data, size, type)
-Vmalloc_t *vm;
-Void_t *data;
-size_t size;
-int type;
-#endif
 {
     reg Vmdata_t *vd = vm->data;
 
@@ -244,23 +218,12 @@ int type;
     return data;
 }
 
-#if __STD_C
 static long poolsize(Vmalloc_t * vm, Void_t * addr)
-#else
-static long poolsize(vm, addr)
-Vmalloc_t *vm;
-Void_t *addr;
-#endif
 {
     return pooladdr(vm, addr) == 0 ? (long) vm->data->pool : -1L;
 }
 
-#if __STD_C
 static int poolcompact(Vmalloc_t * vm)
-#else
-static int poolcompact(vm)
-Vmalloc_t *vm;
-#endif
 {
     reg Block_t *fp;
     reg Seg_t *seg, *next;
@@ -296,14 +259,7 @@ Vmalloc_t *vm;
     return 0;
 }
 
-#if __STD_C
 static Void_t *poolalign(Vmalloc_t * vm, size_t size, size_t align)
-#else
-static Void_t *poolalign(vm, size, align)
-Vmalloc_t *vm;
-size_t size;
-size_t align;
-#endif
 {
     NOTUSED(vm);
     NOTUSED(size);
index c07dddbadaced6e3213a2634784a82a9ea1b2b8d..0f3ad4c27cdf05e6589fdba48cfe244dcc8cb6f3 100644 (file)
@@ -23,16 +23,15 @@ static char *Version = "\n@(#)Vmalloc (AT&T Labs - kpv) 1999-08-05\0\n";
 **     Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
 */
 
-/* Get more memory for a region */
-#if __STD_C
+/**
+ * Get more memory for a region
+ *
+ * @param vm region to increase in size
+ * @param size desired amount of space
+ * @param searchf tree search function
+ */
 static Block_t *vmextend(reg Vmalloc_t * vm, size_t size,
                         Vmsearch_f searchf)
-#else
-static Block_t *vmextend(vm, size, searchf)
-reg Vmalloc_t *vm;             /* region to increase in size   */
-size_t size;                   /* desired amount of space      */
-Vmsearch_f searchf;            /* tree search function         */
-#endif
 {
     reg size_t s;
     reg Seg_t *seg;
@@ -185,16 +184,15 @@ Vmsearch_f searchf;               /* tree search function         */
     return bp;
 }
 
-/* Truncate a segment if possible */
-#if __STD_C
+/**
+ * Truncate a segment if possible
+ *
+ * @param vm containing region
+ * @param seg the one to be truncated
+ * @param size amount of free space
+ * @param exact amount given was exact
+ */
 static int vmtruncate(Vmalloc_t * vm, Seg_t * seg, size_t size, int exact)
-#else
-static int vmtruncate(vm, seg, size, exact)
-Vmalloc_t *vm;                 /* containing region            */
-Seg_t *seg;                    /* the one to be truncated      */
-size_t size;                   /* amount of free space         */
-int exact;                     /* amount given was exact       */
-#endif
 {
     reg Void_t *caddr;
     reg Seg_t *last;
index 1bb6756a4dc331a8e9c6ea54f5e439a22fa6a4a7..8d8a8b657b88b3bf7f9cc4cf9eccfb8a38838cfd 100644 (file)
@@ -57,14 +57,12 @@ static Pfobj_t **Pftable;   /* hash table           */
 #define PFTABLE                1019    /* table size           */
 static Vmalloc_t *Vmpf;                /* heap for our own use */
 
-#if __STD_C
+/**
+ * @param vm region allocating from
+ * @param file the file issuing the allocation request
+ * @param line line number
+ */
 static Pfobj_t *pfsearch(Vmalloc_t * vm, char *file, int line)
-#else
-static Pfobj_t *pfsearch(vm, file, line)
-Vmalloc_t *vm;                 /* region allocating from                       */
-char *file;                    /* the file issuing the allocation request      */
-int line;                      /* line number                                  */
-#endif
 {
     reg Pfobj_t *pf, *last;
     reg Vmulong_t h;
@@ -166,12 +164,7 @@ int line;                  /* line number                                  */
     return pf;
 }
 
-#if __STD_C
 static void pfclose(Vmalloc_t * vm)
-#else
-static void pfclose(vm)
-Vmalloc_t *vm;
-#endif
 {
     reg int n;
     reg Pfobj_t *pf, *next, *last;
@@ -195,17 +188,8 @@ Vmalloc_t *vm;
     }
 }
 
-#if __STD_C
 static void pfsetinfo(Vmalloc_t * vm, Vmuchar_t * data, size_t size,
                      char *file, int line)
-#else
-static void pfsetinfo(vm, data, size, file, line)
-Vmalloc_t *vm;
-Vmuchar_t *data;
-size_t size;
-char *file;
-int line;
-#endif
 {
     reg Pfobj_t *pf;
     reg Vmulong_t s;
@@ -235,12 +219,7 @@ int line;
 }
 
 /* sort by file names and line numbers */
-#if __STD_C
 static Pfobj_t *pfsort(Pfobj_t * pf)
-#else
-static Pfobj_t *pfsort(pf)
-Pfobj_t *pf;
-#endif
 {
     reg Pfobj_t *one, *two, *next;
     reg int cmp;
@@ -305,20 +284,9 @@ Pfobj_t *pf;
     }
 }
 
-#if __STD_C
 static char *pfsummary(char *buf, Vmulong_t na, Vmulong_t sa,
                       Vmulong_t nf, Vmulong_t sf, Vmulong_t max,
                       Vmulong_t size)
-#else
-static char *pfsummary(buf, na, sa, nf, sf, max, size)
-char *buf;
-Vmulong_t na;
-Vmulong_t sa;
-Vmulong_t nf;
-Vmulong_t sf;
-Vmulong_t max;
-Vmulong_t size;
-#endif
 {
     buf = (*_Vmstrcpy) (buf, "n_alloc", '=');
     buf = (*_Vmstrcpy) (buf, (*_Vmitoa) (na, -1), ':');
@@ -340,13 +308,7 @@ Vmulong_t size;
 }
 
 /* print profile data */
-#if __STD_C
 int vmprofile(Vmalloc_t * vm, int fd)
-#else
-int vmprofile(vm, fd)
-Vmalloc_t *vm;
-int fd;
-#endif
 {
     reg Pfobj_t *pf, *list, *next, *last;
     reg int n;
@@ -452,13 +414,7 @@ int fd;
     return 0;
 }
 
-#if __STD_C
 static Void_t *pfalloc(Vmalloc_t * vm, size_t size)
-#else
-static Void_t *pfalloc(vm, size)
-Vmalloc_t *vm;
-size_t size;
-#endif
 {
     reg size_t s;
     reg Void_t *data;
@@ -487,13 +443,7 @@ size_t size;
     return data;
 }
 
-#if __STD_C
 static int pffree(Vmalloc_t * vm, Void_t * data)
-#else
-static int pffree(vm, data)
-Vmalloc_t *vm;
-Void_t *data;
-#endif
 {
     reg Pfobj_t *pf;
     reg size_t s;
@@ -539,16 +489,8 @@ Void_t *data;
     return (*(Vmbest->freef)) (vm, data);
 }
 
-#if __STD_C
 static Void_t *pfresize(Vmalloc_t * vm, Void_t * data, size_t size,
                        int type)
-#else
-static Void_t *pfresize(vm, data, size, type)
-Vmalloc_t *vm;
-Void_t *data;
-size_t size;
-int type;
-#endif
 {
     reg Pfobj_t *pf;
     reg size_t s, news;
@@ -628,46 +570,22 @@ int type;
     return addr;
 }
 
-#if __STD_C
 static long pfsize(Vmalloc_t * vm, Void_t * addr)
-#else
-static long pfsize(vm, addr)
-Vmalloc_t *vm;
-Void_t *addr;
-#endif
 {
     return (*Vmbest->addrf) (vm, addr) != 0 ? -1L : (long) PFSIZE(addr);
 }
 
-#if __STD_C
 static long pfaddr(Vmalloc_t * vm, Void_t * addr)
-#else
-static long pfaddr(vm, addr)
-Vmalloc_t *vm;
-Void_t *addr;
-#endif
 {
     return (*Vmbest->addrf) (vm, addr);
 }
 
-#if __STD_C
 static int pfcompact(Vmalloc_t * vm)
-#else
-static int pfcompact(vm)
-Vmalloc_t *vm;
-#endif
 {
     return (*Vmbest->compactf) (vm);
 }
 
-#if __STD_C
 static Void_t *pfalign(Vmalloc_t * vm, size_t size, size_t align)
-#else
-static Void_t *pfalign(vm, size, align)
-Vmalloc_t *vm;
-size_t size;
-size_t align;
-#endif
 {
     reg size_t s;
     reg Void_t *data;
index e34edc0b01df60ef6a88f8e67880c2f7c7ee713c..1f7d8c46aed86d66425ab24ebb4c936d4cd36ab9 100644 (file)
 **
 **     Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
 */
-#if __STD_C
 Vmalloc_t *vmregion(reg Void_t * addr)
-#else
-Vmalloc_t *vmregion(addr)
-reg Void_t *addr;
-#endif
 {
     return addr ? VM(BLOCK(addr)) : NIL(Vmalloc_t *);
 }
index ff5624a405e3c5442a19486dbc88982a6c3e8a93..8e11db263bcab4ccdbc2445d3730fa90225cbaa8 100644 (file)
 **     Written by Kiem-Phong Vo, kpv@research.att.com, 02/07/95
 */
 
-#if __STD_C
+/**
+ * @param vm region
+ * @param addr address
+ */
 Void_t *vmsegment(Vmalloc_t * vm, Void_t * addr)
-#else
-Void_t *vmsegment(vm, addr)
-Vmalloc_t *vm;                 /* region       */
-Void_t *addr;                  /* address      */
-#endif
 {
     reg Seg_t *seg;
     reg Vmdata_t *vd = vm->data;
index 53e23abf920b86b179627bc999c82e57666bb055..9751a1636434eb47109697aa65e1fb20f3004508 100644 (file)
 **
 **     Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
 */
-#if __STD_C
+/**
+ * @param vm region being worked on
+ * @param flags flags must be in VM_FLAGS
+ * @param on !=0 if turning on, else turning off
+ */
 int vmset(reg Vmalloc_t * vm, int flags, int on)
-#else
-int vmset(vm, flags, on)
-reg Vmalloc_t *vm;             /* region being worked on               */
-int flags;                     /* flags must be in VM_FLAGS            */
-int on;                                /* !=0 if turning on, else turning off  */
-#endif
 {
     reg int mode;
     reg Vmdata_t *vd = vm->data;
index 8d42b4c70e44eebe7885c0d5ea57c7e0ff5de43d..6f68d22d71071c8bb5e829fa62dc75260a978535 100644 (file)
 **     Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
 */
 
-#if __STD_C
 int vmstat(Vmalloc_t * vm, Vmstat_t * st)
-#else
-int vmstat(vm, st)
-Vmalloc_t *vm;
-Vmstat_t *st;
-#endif
 {
     reg Seg_t *seg;
     reg Block_t *b, *endb;
index ddf70e19de96e15b0279fb3dc135bfc4c7c85a5a..e6cc29c6061015120aaa802468dfb22c557b0c31 100644 (file)
 static int Trfile = -1;
 static char Trbuf[128];
 
-#if __STD_C
 static char *trstrcpy(char *to, char *from, int endc)
-#else
-static char *trstrcpy(to, from, endc)
-char *to;
-char *from;
-int endc;
-#endif
 {
     reg int n;
 
@@ -40,14 +33,13 @@ int endc;
     return to;
 }
 
-/* convert a long value to an ascii representation */
-#if __STD_C
+/*
+ * convert a long value to an ascii representation
+ *
+ * @param v value to convert
+ * @param type =0 base-16, >0: unsigned base-10, <0: signed base-10
+ */
 static char *tritoa(Vmulong_t v, int type)
-#else
-static char *tritoa(v, type)
-Vmulong_t v;                   /* value to convert                                     */
-int type;                      /* =0 base-16, >0: unsigned base-10, <0: signed base-10 */
-#endif
 {
     char *s;
 
@@ -82,19 +74,17 @@ int type;                   /* =0 base-16, >0: unsigned base-10, <0: signed base-10 */
     return s + 1;
 }
 
-/* generate a trace of some call */
-#if __STD_C
+/**
+ * generate a trace of some call
+ * @param vm region call was made from
+ * @param newaddr old data address
+ * @param newaddr new data address
+ * @param size size of piece
+ * @param align alignment
+ */
 static void trtrace(Vmalloc_t * vm,
                    Vmuchar_t * oldaddr, Vmuchar_t * newaddr, size_t size,
                    size_t align)
-#else
-static void trtrace(vm, oldaddr, newaddr, size, align)
-Vmalloc_t *vm;                 /* region call was made from    */
-Vmuchar_t *oldaddr;            /* old data address             */
-Vmuchar_t *newaddr;            /* new data address             */
-size_t size;                   /* size of piece                */
-size_t align;                  /* alignment                    */
-#endif
 {
     char buf[1024], *bufp, *endbuf;
     reg Vmdata_t *vd = vm->data;
@@ -144,12 +134,7 @@ size_t align;                      /* alignment                    */
     write(Trfile, buf, (bufp - buf));
 }
 
-#if __STD_C
 int vmtrace(int file)
-#else
-int vmtrace(file)
-int file;
-#endif
 {
     int fd;
 
@@ -162,12 +147,7 @@ int file;
     return fd;
 }
 
-#if __STD_C
 int vmtrbusy(Vmalloc_t * vm)
-#else
-int vmtrbusy(vm)
-Vmalloc_t *vm;
-#endif
 {
     Seg_t *seg;
     Vmdata_t *vd = vm->data;
index 61929a6daf807bcd136f0a17378386a60fadaa62..a07dbce25be83eb28ddbe5b840042c6a5ff7d652 100644 (file)
 **     Written by Kiem-Phong Vo, kpv@research.att.com (02/08/96)
 */
 
-#if __STD_C
 int vmwalk(Vmalloc_t * vm,
           int (*segf) (Vmalloc_t *, Void_t *, size_t, Vmdisc_t *))
-#else
-int vmwalk(vm, segf)
-Vmalloc_t *vm;
-int (*segf) ( /* Vmalloc_t*, Void_t*, size_t, Vmdisc_t* */ );
-#endif
 {
     reg Seg_t *seg;
     reg int rv;