1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

use stdint.h where appropriate. okay millert@

This commit is contained in:
espie 2006-01-20 23:10:19 +00:00
parent 86047a8661
commit 0b7a013e1b
15 changed files with 59 additions and 56 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: eval.c,v 1.58 2005/09/06 15:33:21 espie Exp $ */
/* $OpenBSD: eval.c,v 1.59 2006/01/20 23:10:19 espie Exp $ */
/* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */
/*
@ -97,7 +97,7 @@ unsigned long expansion_id;
void
eval(const char *argv[], int argc, int td, int is_traced)
{
ssize_t mark = -1;
size_t mark = SIZE_MAX;
expansion_id++;
if (td & RECDEF)
@ -109,7 +109,7 @@ eval(const char *argv[], int argc, int td, int is_traced)
expand_macro(argv, argc);
else
expand_builtin(argv, argc, td);
if (mark != -1)
if (mark != SIZE_MAX)
finish_trace(mark);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: expr.c,v 1.16 2004/05/12 21:17:03 espie Exp $ */
/* $OpenBSD: expr.c,v 1.17 2006/01/20 23:10:19 espie Exp $ */
/*
* Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org>
*
@ -14,7 +14,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
#include <stdint.h>
#include <stdio.h>
#include <stddef.h>
#include "mdef.h"

View File

@ -1,4 +1,4 @@
/* $OpenBSD: extern.h,v 1.42 2005/09/06 15:33:21 espie Exp $ */
/* $OpenBSD: extern.h,v 1.43 2006/01/20 23:10:19 espie Exp $ */
/* $NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk Exp $ */
/*-
@ -138,7 +138,7 @@ extern char *endest;
extern unsigned int trace_flags;
#define TRACE_ALL 512
extern void trace_file(const char *);
extern ssize_t trace(const char **, int, struct input_file *);
extern size_t trace(const char **, int, struct input_file *);
extern void finish_trace(size_t);
extern void set_trace_flags(const char *);
extern FILE *traceout;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: look.c,v 1.17 2005/08/06 16:22:26 espie Exp $ */
/* $OpenBSD: look.c,v 1.18 2006/01/20 23:10:19 espie Exp $ */
/*
* Copyright (c) 1989, 1993
@ -38,9 +38,9 @@
* by: oz
*/
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <ohash.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: main.c,v 1.68 2005/09/06 15:33:21 espie Exp $ */
/* $OpenBSD: main.c,v 1.69 2006/01/20 23:10:19 espie Exp $ */
/* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */
/*-
@ -39,7 +39,6 @@
* by: oz
*/
#include <sys/types.h>
#include <assert.h>
#include <signal.h>
#include <errno.h>
@ -48,6 +47,7 @@
#include <ctype.h>
#include <string.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <ohash.h>
#include <err.h>

View File

@ -1,5 +1,5 @@
%{
/* $OpenBSD: parser.y,v 1.2 2004/06/22 19:21:34 otto Exp $ */
/* $OpenBSD: parser.y,v 1.3 2006/01/20 23:10:19 espie Exp $ */
/*
* Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org>
*
@ -15,6 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <stdint.h>
#define YYSTYPE int32_t
extern int32_t end_result;
extern int yylex(void);

View File

@ -1,5 +1,5 @@
%{
/* $OpenBSD: tokenizer.l,v 1.2 2004/05/12 21:28:35 espie Exp $ */
/* $OpenBSD: tokenizer.l,v 1.3 2006/01/20 23:10:19 espie Exp $ */
/*
* Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org>
*
@ -18,7 +18,7 @@
#include "parser.h"
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <stdint.h>
#include <limits.h>
extern int32_t yylval;
@ -54,7 +54,7 @@ number()
errno = 0;
l = strtol(yytext, NULL, 0);
if (((l == LONG_MAX || l == LONG_MIN) && errno == ERANGE) ||
l > 0x7fffffff || l < (-0x7fffffff - 1)) {
l > INT32_MAX || l < INT32_MIN) {
fprintf(stderr, "m4: numeric overflow in expr: %s\n", yytext);
}
return l;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: trace.c,v 1.12 2005/01/21 19:11:02 espie Exp $ */
/* $OpenBSD: trace.c,v 1.13 2006/01/20 23:10:19 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
*
@ -24,11 +24,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/types.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <err.h>
#include <stdlib.h>
#include <err.h>
#include "mdef.h"
#include "stdd.h"
#include "extern.h"
@ -142,7 +142,7 @@ print_header(struct input_file *inp)
fprintf(traceout, "id %lu: ", expansion_id);
}
ssize_t
size_t
trace(const char *argv[], int argc, struct input_file *inp)
{
if (!traceout)
@ -179,7 +179,7 @@ trace(const char *argv[], int argc, struct input_file *inp)
return buffer_mark();
else {
fprintf(traceout, "\n");
return -1;
return SIZE_MAX;
}
}

View File

@ -1,5 +1,5 @@
/* $OpenPackages$ */
/* $OpenBSD: arch.c,v 1.54 2004/04/07 13:11:35 espie Exp $ */
/* $OpenBSD: arch.c,v 1.55 2006/01/20 23:10:19 espie Exp $ */
/* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */
/*
@ -72,7 +72,6 @@
*/
#include <sys/param.h>
#include <sys/types.h>
#include <ar.h>
#include <assert.h>
#include <ctype.h>
@ -80,6 +79,7 @@
#include <limits.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

View File

@ -1,5 +1,5 @@
/* $OpenPackages$ */
/* $OpenBSD: cond.c,v 1.30 2004/04/07 13:11:35 espie Exp $ */
/* $OpenBSD: cond.c,v 1.31 2006/01/20 23:10:19 espie Exp $ */
/* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */
/*
@ -39,6 +39,7 @@
#include <ctype.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
@ -850,7 +851,7 @@ Cond_Eval(const char *line)
{
/* find end of keyword */
const char *end;
u_int32_t k;
uint32_t k;
size_t len;
struct If *ifp;
bool value = false;

View File

@ -1,5 +1,5 @@
/* $OpenPackages$ */
/* $OpenBSD: dir.c,v 1.43 2005/06/26 15:19:12 mickey Exp $ */
/* $OpenBSD: dir.c,v 1.44 2006/01/20 23:10:19 espie Exp $ */
/* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */
/*
@ -63,12 +63,12 @@
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <limits.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
@ -209,7 +209,7 @@ static struct ohash_info dir_info = { offsetof(Path, name),
static void add_file(Path *, const char *);
/* n = find_file_hashi(p, name, end, hv): retrieve name in a path hash
* structure. */
static char *find_file_hashi(Path *, const char *, const char *, u_int32_t);
static char *find_file_hashi(Path *, const char *, const char *, uint32_t);
/* stamp = find_stampi(name, end): look for (name, end) in the global
* cache. */
@ -280,7 +280,7 @@ add_file(Path *p, const char *file)
}
static char *
find_file_hashi(Path *p, const char *file, const char *efile, u_int32_t hv)
find_file_hashi(Path *p, const char *file, const char *efile, uint32_t hv)
{
struct ohash *h = &p->files;
@ -646,7 +646,7 @@ Dir_FindFilei(const char *name, const char *ename, Lst path)
bool hasSlash;
struct stat stb; /* Buffer for stat, if necessary */
struct file_stamp *entry; /* Entry for mtimes table */
u_int32_t hv; /* hash value for last component in file name */
uint32_t hv; /* hash value for last component in file name */
char *q; /* Str_dupi(name, ename) */
/* Find the final component of the name and note whether name has a

View File

@ -1,5 +1,5 @@
/* $OpenPackages$ */
/* $OpenBSD: generate.c,v 1.5 2002/06/11 21:12:11 espie Exp $ */
/* $OpenBSD: generate.c,v 1.6 2006/01/20 23:10:19 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@ -28,6 +28,7 @@
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "stats.h"
@ -91,10 +92,10 @@ char **table[] = {
int
main(int argc, char *argv[])
{
u_int32_t i;
u_int32_t v;
u_int32_t h;
u_int32_t slots;
uint32_t i;
uint32_t v;
uint32_t h;
uint32_t slots;
const char *e;
char **occupied;
char **t;

View File

@ -1,5 +1,5 @@
/* $OpenPackages$ */
/* $OpenBSD: targ.c,v 1.39 2004/04/07 13:11:36 espie Exp $ */
/* $OpenBSD: targ.c,v 1.40 2006/01/20 23:10:19 espie Exp $ */
/* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */
/*
@ -98,10 +98,10 @@
* print something for suffixes, too, but...
*/
#include <sys/types.h>
#include <limits.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "config.h"
#include "defines.h"

View File

@ -1,5 +1,5 @@
/* $OpenPackages$ */
/* $OpenBSD: var.c,v 1.59 2004/04/07 13:11:36 espie Exp $ */
/* $OpenBSD: var.c,v 1.60 2006/01/20 23:10:19 espie Exp $ */
/* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */
/*
@ -62,10 +62,10 @@
* SUCH DAMAGE.
*/
#include <sys/types.h>
#include <assert.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@ -171,18 +171,18 @@ typedef struct Var_ {
static struct ohash_info var_info = {
offsetof(Var, name),
NULL, hash_alloc, hash_free, element_alloc };
static int quick_lookup(const char *, const char **, u_int32_t *);
static int quick_lookup(const char *, const char **, uint32_t *);
#define VarValue(v) Buf_Retrieve(&((v)->val))
static Var *varfind(const char *, const char *, SymTable *, int, int, u_int32_t);
static Var *varfind(const char *, const char *, SymTable *, int, int, uint32_t);
static Var *VarFindi(const char *, const char *, SymTable *, int);
static Var *VarAdd(const char *, const char *, u_int32_t, const char *, GSymT *);
static Var *VarAdd(const char *, const char *, uint32_t, const char *, GSymT *);
static void VarDelete(void *);
static void VarPrintVar(Var *);
static const char *context_name(GSymT *);
static Var *new_var(const char *, const char *, const char *);
static Var *getvar(GSymT *, const char *, const char *, u_int32_t);
static Var *getvar(GSymT *, const char *, const char *, uint32_t);
static Var *create_var(const char *, const char *);
static Var *var_from_env(const char *, const char *, u_int32_t);
static Var *var_from_env(const char *, const char *, uint32_t);
static void var_init_string(Var *, const char *);
static const char *find_0(const char *);
@ -214,7 +214,7 @@ SymTable_Destroy(SymTable *ctxt)
#endif
static int
quick_lookup(const char *name, const char **enamePtr, u_int32_t *pk)
quick_lookup(const char *name, const char **enamePtr, uint32_t *pk)
{
size_t len;
@ -423,7 +423,7 @@ new_var(const char *name, const char *ename, const char *val)
}
static Var *
var_from_env(const char *name, const char *ename, u_int32_t k)
var_from_env(const char *name, const char *ename, uint32_t k)
{
char *env;
Var *v;
@ -451,7 +451,7 @@ var_from_env(const char *name, const char *ename, u_int32_t k)
}
static Var *
getvar(GSymT *ctxt, const char *name, const char *ename, u_int32_t k)
getvar(GSymT *ctxt, const char *name, const char *ename, uint32_t k)
{
return ohash_find(ctxt, ohash_lookup_interval(ctxt, name, ename, k));
}
@ -477,7 +477,7 @@ VarFindi(const char *name, /* name to find */
* FIND_ENV set means to look in the
* environment */
{
u_int32_t k;
uint32_t k;
int idx;
#ifdef STATS_VAR_LOOKUP
@ -490,7 +490,7 @@ VarFindi(const char *name, /* name to find */
static Var *
varfind(const char *name, const char *ename, SymTable *ctxt, int flags,
int idx, u_int32_t k)
int idx, uint32_t k)
{
Var *v;
@ -566,7 +566,7 @@ varfind(const char *name, const char *ename, SymTable *ctxt, int flags,
*-----------------------------------------------------------------------
*/
static Var *
VarAdd(const char *name, const char *ename, u_int32_t k, const char *val,
VarAdd(const char *name, const char *ename, uint32_t k, const char *val,
GSymT *ctxt)
{
Var *v;
@ -603,7 +603,7 @@ void
Var_Delete(const char *name)
{
Var *v;
u_int32_t k;
uint32_t k;
unsigned int slot;
const char *ename = NULL;
int idx;
@ -632,7 +632,7 @@ void
Var_Seti(const char *name, const char *ename, const char *val, GSymT *ctxt)
{
Var *v;
u_int32_t k;
uint32_t k;
int idx;
idx = quick_lookup(name, &ename, &k);
@ -670,7 +670,7 @@ void
Var_Appendi(const char *name, const char *ename, const char *val, GSymT *ctxt)
{
Var *v;
u_int32_t k;
uint32_t k;
int idx;
assert(ctxt == VAR_GLOBAL || ctxt == VAR_CMD);
@ -823,7 +823,7 @@ Var_Parse(const char *str, /* The string to parse */
struct Name name;
const char *start;
char *val; /* Variable value */
u_int32_t k;
uint32_t k;
int idx;
*freePtr = false;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: tsort.c,v 1.19 2004/08/05 10:59:42 espie Exp $ */
/* $OpenBSD: tsort.c,v 1.20 2006/01/20 23:10:19 espie Exp $ */
/* ex:ts=8 sw=4:
*
* Copyright (c) 1999-2004 Marc Espie <espie@openbsd.org>
@ -16,18 +16,18 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
#include <assert.h>
#include <ctype.h>
#include <err.h>
#include <limits.h>
#include <stddef.h>
#include <ohash.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
#include <ohash.h>
/* The complexity of topological sorting is O(e), where e is the
* size of input. While reading input, vertices have to be identified,