Merge "Sync with upstream NetBSD."

This commit is contained in:
Treehugger Robot 2019-02-14 00:04:20 +00:00 committed by Gerrit Code Review
commit b5c1b12389
3 changed files with 15 additions and 11 deletions

View file

@ -1,4 +1,4 @@
/* $NetBSD: random.c,v 1.4 2014/06/12 20:59:46 christos Exp $ */ /* $NetBSD: random.c,v 1.5 2016/02/08 05:27:24 dholland Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -35,7 +35,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95"; static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95";
#else #else
__RCSID("$NetBSD: random.c,v 1.4 2014/06/12 20:59:46 christos Exp $"); __RCSID("$NetBSD: random.c,v 1.5 2016/02/08 05:27:24 dholland Exp $");
#endif #endif
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
@ -92,7 +92,7 @@ static long random_unlocked(void);
* state information, which will allow a degree seven polynomial. (Note: * state information, which will allow a degree seven polynomial. (Note:
* the zeroeth word of state information also has some other information * the zeroeth word of state information also has some other information
* stored in it -- see setstate() for details). * stored in it -- see setstate() for details).
* *
* The random number generation technique is a linear feedback shift register * The random number generation technique is a linear feedback shift register
* approach, employing trinomials (since there are fewer terms to sum up that * approach, employing trinomials (since there are fewer terms to sum up that
* way). In this approach, the least significant bit of all the numbers in * way). In this approach, the least significant bit of all the numbers in
@ -318,12 +318,12 @@ srandom(unsigned int x)
* the break values for the different R.N.G.'s, we choose the best (largest) * the break values for the different R.N.G.'s, we choose the best (largest)
* one we can and set things up for it. srandom() is then called to * one we can and set things up for it. srandom() is then called to
* initialize the state information. * initialize the state information.
* *
* Note that on return from srandom(), we set state[-1] to be the type * Note that on return from srandom(), we set state[-1] to be the type
* multiplexed with the current value of the rear pointer; this is so * multiplexed with the current value of the rear pointer; this is so
* successive calls to initstate() won't lose this information and will be * successive calls to initstate() won't lose this information and will be
* able to restart with setstate(). * able to restart with setstate().
* *
* Note: the first thing we do is save the current state, if any, just like * Note: the first thing we do is save the current state, if any, just like
* setstate() so that it doesn't matter when initstate is called. * setstate() so that it doesn't matter when initstate is called.
* *
@ -511,7 +511,7 @@ random(void)
{ {
static u_long randseed = 1; static u_long randseed = 1;
long x, hi, lo, t; long x, hi, lo, t;
/* /*
* Compute x[n + 1] = (7^5 * x[n]) mod (2^31 - 1). * Compute x[n + 1] = (7^5 * x[n]) mod (2^31 - 1).
* From "Random number generators: good ones are hard to find", * From "Random number generators: good ones are hard to find",

View file

@ -1,4 +1,4 @@
/* $NetBSD: dst.h,v 1.1.1.4 2009/04/12 16:35:44 christos Exp $ */ /* $NetBSD: dst.h,v 1.2 2014/08/03 19:14:24 wiz Exp $ */
#ifndef DST_H #ifndef DST_H
#define DST_H #define DST_H
@ -55,7 +55,7 @@ typedef struct dst_key {
#define dst_write_key __dst_write_key #define dst_write_key __dst_write_key
/* /*
* DST Crypto API defintions * DST Crypto API definitions
*/ */
void dst_init(void); void dst_init(void);
int dst_check_algorithm(const int); int dst_check_algorithm(const int);

View file

@ -1,4 +1,4 @@
/* $NetBSD: regcomp.c,v 1.36 2015/09/12 19:08:47 christos Exp $ */ /* $NetBSD: regcomp.c,v 1.38 2019/02/07 22:22:31 christos Exp $ */
/*- /*-
* Copyright (c) 1992, 1993, 1994 * Copyright (c) 1992, 1993, 1994
@ -76,7 +76,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)regcomp.c 8.5 (Berkeley) 3/20/94"; static char sccsid[] = "@(#)regcomp.c 8.5 (Berkeley) 3/20/94";
#else #else
__RCSID("$NetBSD: regcomp.c,v 1.36 2015/09/12 19:08:47 christos Exp $"); __RCSID("$NetBSD: regcomp.c,v 1.38 2019/02/07 22:22:31 christos Exp $");
#endif #endif
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
@ -474,6 +474,8 @@ p_ere_exp(
REQUIRE(!MORE() || !isdigit((unsigned char)PEEK()), REG_BADRPT); REQUIRE(!MORE() || !isdigit((unsigned char)PEEK()), REG_BADRPT);
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
if (p->error != 0)
return;
ordinary(p, c); ordinary(p, c);
break; break;
} }
@ -692,6 +694,8 @@ p_simp_re(
REQUIRE(starordinary, REG_BADRPT); REQUIRE(starordinary, REG_BADRPT);
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
if (p->error != 0)
return(0);
ordinary(p, c &~ BACKSL); ordinary(p, c &~ BACKSL);
break; break;
} }
@ -1007,7 +1011,7 @@ p_b_coll_elem(
} }
len = p->next - sp; len = p->next - sp;
for (cp = cnames; cp->name != NULL; cp++) for (cp = cnames; cp->name != NULL; cp++)
if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') if (strncmp(cp->name, sp, len) == 0 && strlen(cp->name) == len)
return(cp->code); /* known name */ return(cp->code); /* known name */
if (len == 1) if (len == 1)
return(*sp); /* single character */ return(*sp); /* single character */