More ansification.

This commit is contained in:
David Given 2017-08-06 15:57:49 +02:00
parent 68a72f7672
commit b83173734d
6 changed files with 22 additions and 46 deletions

View file

@ -20,8 +20,6 @@ static char rcsid[] = "$Id$";
#define ENDLIB ((long)0)
extern ind_t hard_alloc();
static struct ar_hdr arhdr;
/*

View file

@ -25,15 +25,17 @@ static char rcsid[] = "$Id$";
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <out.h>
#include "const.h"
#include "assert.h"
#include "debug.h"
#include "memory.h"
#include "object.h"
static copy_down();
static copy_up();
static free_saved_moduls();
static void copy_down(struct memory* mem, ind_t dist);
static void copy_up(struct memory* mem, ind_t dist);
static void free_saved_moduls(void);
struct memory mems[NMEMS];
@ -45,8 +47,7 @@ ind_t core_position = (ind_t)0; /* Index of current module. */
static char *BASE;
static ind_t refused;
sbreak(incr)
ind_t incr;
static int sbreak(ind_t incr)
{
unsigned int inc;
@ -69,12 +70,11 @@ sbreak(incr)
* Initialize some pieces of core. We hope that this will be our last
* real allocation, meaning we've made the right choices.
*/
init_core()
void init_core(void)
{
register char *base;
register ind_t total_size;
register struct memory *mem;
extern char *sbrk();
#include "mach.h"
#define ALIGN 8 /* minimum alignment for pieces */
@ -175,9 +175,7 @@ extern int passnumber;
* enough bytes, the first or the second time.
*/
static bool
compact(piece, incr, flag)
register int piece;
register ind_t incr;
compact(int piece, ind_t incr, int flag)
#define NORMAL 0
#define FREEZE 1
#define FORCED 2
@ -315,10 +313,8 @@ compact(piece, incr, flag)
* overlap with the old area, but we do not want to overwrite them before they
* are copied.
*/
static
copy_down(mem, dist)
register struct memory *mem;
ind_t dist;
static void
copy_down(struct memory* mem, ind_t dist)
{
register char *old;
register char *new;
@ -338,10 +334,7 @@ copy_down(mem, dist)
* overlap with the old area, but we do not want to overwrite them before they
* are copied.
*/
static
copy_up(mem, dist)
register struct memory *mem;
ind_t dist;
static void copy_up(struct memory* mem, ind_t dist)
{
register char *old;
register char *new;
@ -364,10 +357,7 @@ static int alloctype = NORMAL;
* how many times the area is moved, because of another allocate, this offset
* remains valid.
*/
ind_t
alloc(piece, size)
int piece;
register long size;
ind_t alloc(int piece, long size)
{
register ind_t incr = 0;
ind_t left = mems[piece].mem_left;
@ -405,9 +395,7 @@ alloc(piece, size)
* attempt fails, release the space occupied by other pieces and try again.
*/
ind_t
hard_alloc(piece, size)
register int piece;
register long size;
hard_alloc(int piece, long size)
{
register ind_t ret;
register int i;
@ -452,8 +440,8 @@ hard_alloc(piece, size)
* at the start of the piece allocated for module contents, thereby
* overwriting the saved modules, and release its space.
*/
static
free_saved_moduls()
static void
free_saved_moduls(void)
{
register ind_t size;
register char *old, *new;
@ -551,7 +539,7 @@ freeze_core()
* To transform the various pieces of the output in core to the file format,
* we must order the bytes in the unsigned shorts and longs as ACK prescribes.
*/
write_bytes()
void write_bytes(void)
{
unsigned short nsect;
long offchar;
@ -609,10 +597,7 @@ write_bytes()
}
}
namecpy(name, nname, offchar)
register struct outname *name;
register unsigned nname;
register long offchar;
void namecpy(struct outname* name, unsigned nname, long offchar)
{
while (nname--) {
if (name->on_foff)

View file

@ -38,7 +38,10 @@ extern struct memory mems[];
#define int_align(sz) (((sz)+(sizeof(int)-1))&~(int)(sizeof(int)-1))
extern ind_t core_position;
extern ind_t hard_alloc();
extern ind_t alloc();
extern void init_core(void);
extern ind_t hard_alloc(int piece, long size);
extern ind_t alloc(int piece, long size);
extern void dealloc(int piece);
extern void core_free(int piece, char* p);
extern void write_bytes(void);
extern void namecpy(struct outname* name, unsigned nname, long offchar);

View file

@ -68,8 +68,6 @@ savechar(piece, off)
{
register long len;
register ind_t newoff;
extern ind_t alloc();
extern ind_t hard_alloc();
if (off == (ind_t)0)
return 0;

View file

@ -195,7 +195,6 @@ static bool
all_alloc(void)
{
struct outhead head;
extern ind_t hard_alloc();
if (hard_alloc(ALLOMODL, (long)sizeof(struct outhead)) == BADOFF)
fatal("no space for module header");
@ -220,8 +219,6 @@ direct_alloc(head)
register struct outsect *sects;
unsigned short nsect = head->oh_nsect;
long size, rest;
extern ind_t hard_alloc();
extern ind_t alloc();
#ifdef SYMDBUG
rest = nsect * sizeof(ind_t) + sizeof(ind_t) + sizeof(ind_t);
@ -293,7 +290,6 @@ putemitindex(ind_t sectindex, ind_t emitoff, int allopiece)
{
long flen;
ind_t emitindex;
extern ind_t alloc();
static long zeros[MAXSECT];
register long zero = zeros[allopiece - ALLOEMIT];
@ -332,7 +328,6 @@ static bool
putreloindex(ind_t relooff, long nrelobytes)
{
ind_t reloindex;
extern ind_t alloc();
if ((reloindex = alloc(ALLORELO, nrelobytes)) != BADOFF) {
*(ind_t *)modulptr(relooff) = reloindex;
@ -348,7 +343,6 @@ static bool
putdbugindex(ind_t dbugoff, long ndbugbytes)
{
ind_t dbugindex;
extern ind_t alloc();
if ((dbugindex = alloc(ALLODBUG, ndbugbytes)) != BADOFF) {
*(ind_t *)modulptr(dbugoff) = dbugindex;
@ -425,7 +419,6 @@ read_modul(void)
unsigned short nsect, nname;
long size;
long nchar;
extern ind_t hard_alloc();
assert(passnumber == SECOND);
assert(!incore);

View file

@ -100,7 +100,6 @@ entername(name, hashval)
register struct symbol *sym;
struct outname *newname;
extern ind_t savechar();
extern ind_t hard_alloc();
debug("entername %s %d %x %x", modulptr((ind_t)name->on_foff), hashval, name->on_type, name->on_desc);
savindex = savechar(ALLOGCHR, (ind_t)name->on_foff);