...
 
Commits (5)
VMS Code removed
MYMALLOC Code removed
Build system changed to SCons 3.0
--
Internet connectivity (-I option). Arpatxt decommissioned.
Nets without names.
Allow negative cost components; prohibit negative costs.
......
Import(Split("env DBM PREFIX MANDIR"))
CSRC = Split("addlink.c addnode.c domain.c local.c main.c mapit.c mapaux.c mem.c printit.c")
LSRC = CSRC + Split("parse.c")
SRC = CSRC + Split("parse.y makedb.c")
BINDIR = PREFIX + "/bin"
pathalias=env.Program(target = 'pathalias', source = CSRC + ['parse.y'])
......
......@@ -8,7 +8,7 @@ EnsurePythonVersion(2,7)
# defaults
PACKAGE='pathalias'
VERSION='9.16.1'
VERSION='9.16.2'
PREFIX='/usr/local'
from debugmode import checkForDebugBuild
......
......@@ -14,39 +14,8 @@ static char *c_sccsid = "@(#)config.h 9.5 91/06/11";
#define STDIO_H <stdio.h>
#define CTYPE_H <ctype.h>
#ifdef VMS
#include ssdef
#include stsdef
#undef NULL_DEVICE
#define NULL_DEVICE "NL:"
#undef OK
#define OK SS$_NORMAL
#undef ERROR
#define ERROR (STS$K_ERROR|STS$M_INHIB_MSG)
#undef SEVERE_ERROR
#define SEVERE_ERROR (STS$K_SEVERE|STS$M_INHIB_MSG)
#undef STDIO_H
#define STDIO_H stdio
#undef CTYPE_H
#define CTYPE_H ctype
#endif
#ifdef MYMALLOC
#define malloc mymalloc
#define calloc(n, s) malloc ((n)*(s))
#define free(s)
#define cfree(s)
extern char *memget();
#else /* !MYMALLOC */
#include <stdlib.h>
#include <string.h>
#endif /* MYMALLOC */
#ifdef STRCHR
#define index strchr
......
......@@ -3,11 +3,7 @@
static char *sccsid = "@(#)main.c 9.8 91/06/11";
#endif
#ifndef VMS
#define MAIN main
#else
#define MAIN XXmain
#endif
#include "def.h"
......
......@@ -103,13 +103,7 @@ freetable(t, size)
node **t;
long size;
{
#ifdef MYMALLOC
STATIC void addtoheap();
addtoheap((char *) t, size * sizeof(node *));
#else
free((char *) t);
#endif
}
STATIC void
......@@ -154,118 +148,3 @@ wasted()
return;
vprintf(stderr, "memory allocator wasted %ld bytes\n", Memwaste);
}
#ifdef MYMALLOC
/* use c library malloc/calloc here, and here only */
#undef malloc
#undef calloc
/* imports */
extern char *malloc(), *calloc();
/* private */
STATIC int align();
/* allocate in MBUFSIZ chunks. 4k works ok (less 16 for malloc quirks). */
#define MBUFSIZ (4 * 1024 - 16)
/*
* mess with ALIGN at your peril. longword (== 0 mod 4)
* alignment seems to work everywhere.
*/
#define ALIGN 2
typedef struct heap heap;
struct heap {
heap *h_next;
long h_size;
};
static heap *Mheap; /* not to be confused with a priority queue */
STATIC void
addtoheap(p, size)
char *p;
long size;
{ int adjustment;
heap *pheap;
/* p is aligned, but it doesn't hurt to check */
adjustment = align(p);
p += adjustment;
size -= adjustment;
if (size < 1024)
return; /* can't happen */
pheap = (heap *) p; /* pheap is shorthand */
pheap->h_next = Mheap;
pheap->h_size = size;
Mheap = pheap;
}
/*
* buffered malloc()
* returns space initialized to 0. calloc isn't used, since
* strclear can be faster.
*
* free is ignored, except for very large objects,
* which are returned to the heap with addtoheap().
*/
char *
mymalloc(n)
register unsigned int n;
{ static unsigned int size; /* how much do we have on hand? */
static char *mstash; /* where is it? */
register char *rval;
if (n >= 1024) { /* for hash table */
rval = malloc(n); /* aligned */
if (rval)
strclear(rval, n);
return rval;
}
n += align((char *) n); /* keep everything aligned */
if (n > size) {
Memwaste += size; /* toss the fragment */
/* look in the heap */
if (Mheap) {
mstash = (char *) Mheap; /* aligned */
size = Mheap->h_size;
Mheap = Mheap->h_next;
} else {
mstash = malloc(MBUFSIZ); /* aligned */
if (mstash == 0) {
size = 0;
return 0;
}
size = MBUFSIZ;
}
strclear(mstash, size); /* what if size > 2^16? */
}
rval = mstash;
mstash += n;
size -= n;
return rval;
}
/*
* what's the (mis-)alignment of n? return the complement of
* n mod 2^ALIGN
*/
STATIC int
align(n)
char *n;
{ register int abits; /* misalignment bits in n */
abits = (int) n & ~(0xff << ALIGN) & 0xff;
if (abits == 0)
return 0;
return (1 << ALIGN) - abits;
}
#endif /*MYMALLOC*/