Use uint32_t in util/led/main.c

This uses uint32_t for the base, file offset, and alignment of each
section, to be consistent with the usage of uint32_t in h/out.h

Also declare setbit() as static.
This commit is contained in:
George Koehler 2016-11-20 11:38:16 -05:00
parent 6e31d46d6f
commit 88c2ea63aa

View file

@ -11,6 +11,7 @@ static char rcsid[] = "$Id$";
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include <out.h> #include <out.h>
#include "const.h" #include "const.h"
#include "debug.h" #include "debug.h"
@ -29,15 +30,16 @@ int Verbose = 0;
static initializations(); static initializations();
static first_pass(); static first_pass();
static long number(); static uint32_t number(const char *);
static setlign(); static void setlign(int, uint32_t);
static setbase(); static void setbase(int, uint32_t);
static struct outname *makename(); static struct outname *makename();
static pass1(); static pass1();
static evaluate(); static evaluate();
static norm_commons(); static norm_commons();
static complete_sections(); static complete_sections();
static change_names(); static change_names();
static bool setbit();
static bool tstbit(); static bool tstbit();
static second_pass(); static second_pass();
static pass2(); static pass2();
@ -249,12 +251,11 @@ first_pass(argv)
* else if it starts with 0, it's octal, * else if it starts with 0, it's octal,
* else it's decimal. * else it's decimal.
*/ */
static long static uint32_t
number(s) number(const char *s)
register char *s;
{ {
register int digit; register int digit;
register long value = 0; register uint32_t value = 0;
register int radix = 10; register int radix = 10;
if (*s == '0') { if (*s == '0') {
@ -289,22 +290,17 @@ number(s)
* not. Only one base may be given. The same applies for alignments. * not. Only one base may be given. The same applies for alignments.
*/ */
static char basemap[MAXSECT / WIDTH]; static char basemap[MAXSECT / WIDTH];
static long sect_base[MAXSECT]; static uint32_t sect_base[MAXSECT];
static char lignmap[MAXSECT / WIDTH]; static char lignmap[MAXSECT / WIDTH];
static long sect_lign[MAXSECT]; static uint32_t sect_lign[MAXSECT];
/*
/* /*
* Set the alignment of section `sectno' to `lign', if this doesn't * Set the alignment of section `sectno' to `lign', if this doesn't
* conflict with earlier alignment. * conflict with earlier alignment.
*/ */
static static void
setlign(sectno, lign) setlign(int sectno, uint32_t lign)
register int sectno;
register long lign;
{ {
extern bool setbit();
if (setbit(sectno, lignmap) && sect_lign[sectno] != lign) if (setbit(sectno, lignmap) && sect_lign[sectno] != lign)
fatal("section has different alignments"); fatal("section has different alignments");
if (lign == (long)0) if (lign == (long)0)
@ -316,13 +312,9 @@ setlign(sectno, lign)
* Set the base of section `sectno' to `base', if no other base has been * Set the base of section `sectno' to `base', if no other base has been
* given yet. * given yet.
*/ */
static static void
setbase(sectno, base) setbase(int sectno, uint32_t base)
register int sectno;
register long base;
{ {
extern bool setbit();
if (setbit(sectno, basemap) && sect_base[sectno] != base) if (setbit(sectno, basemap) && sect_base[sectno] != base)
fatal("section has different bases"); fatal("section has different bases");
sect_base[sectno] = base; sect_base[sectno] = base;
@ -457,8 +449,8 @@ struct orig relorig[MAXSECT];
static static
complete_sections() complete_sections()
{ {
register long base = 0; register uint32_t base = 0;
register long foff; register uint32_t foff;
register struct outsect *sc; register struct outsect *sc;
register int sectindex; register int sectindex;