Sat Oct 31 20:11:53 2009 UTC ()
Fix regexp on LP64 systems.
By the time 'states1' was expanded, it became 'char *' so the code tried
to put 64 bits into an int!
Fixed PR/41924


(dsl)
diff -r1.3 -r1.4 src/dist/nvi/regex/regexec.c

cvs diff -r1.3 -r1.4 src/dist/nvi/regex/Attic/regexec.c (expand / switch to unified diff)

--- src/dist/nvi/regex/Attic/regexec.c 2009/01/18 03:45:50 1.3
+++ src/dist/nvi/regex/Attic/regexec.c 2009/10/31 20:11:53 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: regexec.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */ 1/* $NetBSD: regexec.c,v 1.4 2009/10/31 20:11:53 dsl Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1992, 1993, 1994 Henry Spencer. 4 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
5 * Copyright (c) 1992, 1993, 1994 5 * Copyright (c) 1992, 1993, 1994
6 * The Regents of the University of California. All rights reserved. 6 * The Regents of the University of California. All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to Berkeley by 8 * This code is derived from software contributed to Berkeley by
9 * Henry Spencer of the University of Toronto. 9 * Henry Spencer of the University of Toronto.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -57,27 +57,27 @@ static char sccsid[] = "@(#)regexec.c 8. @@ -57,27 +57,27 @@ static char sccsid[] = "@(#)regexec.c 8.
57#include <limits.h> 57#include <limits.h>
58#include <ctype.h> 58#include <ctype.h>
59#include <regex.h> 59#include <regex.h>
60 60
61#include "utils.h" 61#include "utils.h"
62#include "regex2.h" 62#include "regex2.h"
63 63
64#ifdef notdef 64#ifdef notdef
65static int nope = 0; /* for use in asserts; shuts lint up */ 65static int nope = 0; /* for use in asserts; shuts lint up */
66#endif 66#endif
67 67
68/* macros for manipulating states, small version */ 68/* macros for manipulating states, small version */
69#define states int 69#define states int
70#define states1 states /* for later use in regexec() decision */ 70#define states1 int /* for later use in regexec() decision */
71#define CLEAR(v) ((v) = 0) 71#define CLEAR(v) ((v) = 0)
72#define SET0(v, n) ((v) &= ~(1 << (n))) 72#define SET0(v, n) ((v) &= ~(1 << (n)))
73#define SET1(v, n) ((v) |= 1 << (n)) 73#define SET1(v, n) ((v) |= 1 << (n))
74#define ISSET(v, n) ((v) & (1 << (n))) 74#define ISSET(v, n) ((v) & (1 << (n)))
75#define ASSIGN(d, s) ((d) = (s)) 75#define ASSIGN(d, s) ((d) = (s))
76#define EQ(a, b) ((a) == (b)) 76#define EQ(a, b) ((a) == (b))
77#define STATEVARS int dummy /* dummy version */ 77#define STATEVARS int dummy /* dummy version */
78#define STATESETUP(m, n) /* nothing */ 78#define STATESETUP(m, n) /* nothing */
79#define STATETEARDOWN(m) /* nothing */ 79#define STATETEARDOWN(m) /* nothing */
80#define SETUP(v) ((v) = 0) 80#define SETUP(v) ((v) = 0)
81#define onestate int 81#define onestate int
82#define INIT(o, n) ((o) = (unsigned)1 << (n)) 82#define INIT(o, n) ((o) = (unsigned)1 << (n))
83#define INC(o) ((o) <<= 1) 83#define INC(o) ((o) <<= 1)