[openssh-commits] [openssh] 01/03: upstream: sys/param.h cleanup, mostly using MINIMUM() and
git+noreply at mindrot.org
git+noreply at mindrot.org
Mon Dec 20 12:17:27 AEDT 2021
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 3eead8158393b697f663ec4301e3c7b6f24580b1
Author: deraadt at openbsd.org <deraadt at openbsd.org>
Date: Tue Dec 14 21:25:27 2021 +0000
upstream: sys/param.h cleanup, mostly using MINIMUM() and
<limits.h> ok dtucker
OpenBSD-Regress-ID: 172a4c45d3bcf92fa6cdf6c4b9db3f1b3abe4db0
---
regress/unittests/authopt/tests.c | 3 +--
regress/unittests/bitmap/tests.c | 3 +--
regress/unittests/conversion/tests.c | 3 +--
regress/unittests/hostkeys/test_iterate.c | 3 +--
regress/unittests/kex/test_kex.c | 3 +--
regress/unittests/match/tests.c | 3 +--
regress/unittests/misc/test_argv.c | 3 +--
regress/unittests/misc/test_convtime.c | 4 ++--
regress/unittests/misc/test_expand.c | 3 +--
regress/unittests/misc/test_parse.c | 3 +--
regress/unittests/misc/test_strdelim.c | 3 +--
regress/unittests/misc/tests.c | 3 +--
regress/unittests/sshbuf/test_sshbuf.c | 5 +++--
regress/unittests/sshbuf/test_sshbuf_fixed.c | 3 +--
regress/unittests/sshbuf/test_sshbuf_fuzz.c | 3 +--
regress/unittests/sshbuf/test_sshbuf_getput_basic.c | 3 +--
regress/unittests/sshbuf/test_sshbuf_getput_crypto.c | 3 +--
regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c | 3 +--
regress/unittests/sshbuf/test_sshbuf_misc.c | 3 +--
regress/unittests/sshkey/common.c | 3 +--
regress/unittests/sshkey/test_file.c | 3 +--
regress/unittests/sshkey/test_fuzz.c | 3 +--
regress/unittests/sshkey/test_sshkey.c | 3 +--
regress/unittests/sshsig/tests.c | 3 +--
regress/unittests/test_helper/test_helper.c | 10 ++++++----
25 files changed, 33 insertions(+), 52 deletions(-)
diff --git a/regress/unittests/authopt/tests.c b/regress/unittests/authopt/tests.c
index 9873c09c..d9e19030 100644
--- a/regress/unittests/authopt/tests.c
+++ b/regress/unittests/authopt/tests.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tests.c,v 1.2 2021/07/24 01:54:23 djm Exp $ */
+/* $OpenBSD: tests.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for keys options functions.
@@ -9,7 +9,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/bitmap/tests.c b/regress/unittests/bitmap/tests.c
index f66a4ce4..576b863f 100644
--- a/regress/unittests/bitmap/tests.c
+++ b/regress/unittests/bitmap/tests.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tests.c,v 1.1 2015/01/15 07:36:28 djm Exp $ */
+/* $OpenBSD: tests.c,v 1.2 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for bitmap.h bitmap API
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/conversion/tests.c b/regress/unittests/conversion/tests.c
index bbdc5f5a..5b526f7a 100644
--- a/regress/unittests/conversion/tests.c
+++ b/regress/unittests/conversion/tests.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tests.c,v 1.3 2021/01/18 11:43:34 dtucker Exp $ */
+/* $OpenBSD: tests.c,v 1.4 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for conversions
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/hostkeys/test_iterate.c b/regress/unittests/hostkeys/test_iterate.c
index a5b17d7e..84f26b5c 100644
--- a/regress/unittests/hostkeys/test_iterate.c
+++ b/regress/unittests/hostkeys/test_iterate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_iterate.c,v 1.7 2020/12/21 01:31:06 djm Exp $ */
+/* $OpenBSD: test_iterate.c,v 1.8 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for hostfile.h hostkeys_foreach()
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/kex/test_kex.c b/regress/unittests/kex/test_kex.c
index 3bd71a9f..c26761ee 100644
--- a/regress/unittests/kex/test_kex.c
+++ b/regress/unittests/kex/test_kex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_kex.c,v 1.5 2020/12/29 01:02:15 djm Exp $ */
+/* $OpenBSD: test_kex.c,v 1.6 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test KEX
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/match/tests.c b/regress/unittests/match/tests.c
index 4fefaf4f..f00d1f93 100644
--- a/regress/unittests/match/tests.c
+++ b/regress/unittests/match/tests.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tests.c,v 1.7 2020/07/15 06:43:16 dtucker Exp $ */
+/* $OpenBSD: tests.c,v 1.8 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for matching functions
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/misc/test_argv.c b/regress/unittests/misc/test_argv.c
index 2cfebf2d..682863e7 100644
--- a/regress/unittests/misc/test_argv.c
+++ b/regress/unittests/misc/test_argv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_argv.c,v 1.3 2021/06/08 07:40:12 djm Exp $ */
+/* $OpenBSD: test_argv.c,v 1.4 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc argv handling functions.
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/misc/test_convtime.c b/regress/unittests/misc/test_convtime.c
index 8f9be89f..ef6fd77d 100644
--- a/regress/unittests/misc/test_convtime.c
+++ b/regress/unittests/misc/test_convtime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_convtime.c,v 1.1 2021/03/19 03:25:01 djm Exp $ */
+/* $OpenBSD: test_convtime.c,v 1.2 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc time conversion functions.
*
@@ -8,7 +8,7 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
+#include <limits.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/misc/test_expand.c b/regress/unittests/misc/test_expand.c
index 513c69bc..6f2cd8ad 100644
--- a/regress/unittests/misc/test_expand.c
+++ b/regress/unittests/misc/test_expand.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_expand.c,v 1.2 2021/04/06 09:07:33 dtucker Exp $ */
+/* $OpenBSD: test_expand.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc string expansion functions.
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/misc/test_parse.c b/regress/unittests/misc/test_parse.c
index 727ff3de..1f1ea31d 100644
--- a/regress/unittests/misc/test_parse.c
+++ b/regress/unittests/misc/test_parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_parse.c,v 1.1 2021/03/19 03:25:01 djm Exp $ */
+/* $OpenBSD: test_parse.c,v 1.2 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc user/host/URI parsing functions.
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/misc/test_strdelim.c b/regress/unittests/misc/test_strdelim.c
index 1d9133d4..f7bea4bf 100644
--- a/regress/unittests/misc/test_strdelim.c
+++ b/regress/unittests/misc/test_strdelim.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_strdelim.c,v 1.2 2021/05/21 03:59:01 djm Exp $ */
+/* $OpenBSD: test_strdelim.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc strdelim() and co
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/misc/tests.c b/regress/unittests/misc/tests.c
index b0b7cd43..d086a063 100644
--- a/regress/unittests/misc/tests.c
+++ b/regress/unittests/misc/tests.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tests.c,v 1.7 2021/05/21 03:48:07 djm Exp $ */
+/* $OpenBSD: tests.c,v 1.8 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc helper functions.
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/sshbuf/test_sshbuf.c b/regress/unittests/sshbuf/test_sshbuf.c
index ee77d693..052d4f2b 100644
--- a/regress/unittests/sshbuf/test_sshbuf.c
+++ b/regress/unittests/sshbuf/test_sshbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_sshbuf.c,v 1.1 2014/04/30 05:32:00 djm Exp $ */
+/* $OpenBSD: test_sshbuf.c,v 1.2 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
@@ -9,7 +9,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
# include <stdint.h>
@@ -24,6 +23,8 @@
void sshbuf_tests(void);
+#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
+
void
sshbuf_tests(void)
{
diff --git a/regress/unittests/sshbuf/test_sshbuf_fixed.c b/regress/unittests/sshbuf/test_sshbuf_fixed.c
index df4925f7..dff77f04 100644
--- a/regress/unittests/sshbuf/test_sshbuf_fixed.c
+++ b/regress/unittests/sshbuf/test_sshbuf_fixed.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_sshbuf_fixed.c,v 1.1 2014/04/30 05:32:00 djm Exp $ */
+/* $OpenBSD: test_sshbuf_fixed.c,v 1.2 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
@@ -9,7 +9,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
# include <stdint.h>
diff --git a/regress/unittests/sshbuf/test_sshbuf_fuzz.c b/regress/unittests/sshbuf/test_sshbuf_fuzz.c
index e236c82f..e3f570be 100644
--- a/regress/unittests/sshbuf/test_sshbuf_fuzz.c
+++ b/regress/unittests/sshbuf/test_sshbuf_fuzz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_sshbuf_fuzz.c,v 1.2 2018/10/17 23:28:05 djm Exp $ */
+/* $OpenBSD: test_sshbuf_fuzz.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
# include <stdint.h>
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_basic.c b/regress/unittests/sshbuf/test_sshbuf_getput_basic.c
index bea89881..3da413ed 100644
--- a/regress/unittests/sshbuf/test_sshbuf_getput_basic.c
+++ b/regress/unittests/sshbuf/test_sshbuf_getput_basic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_sshbuf_getput_basic.c,v 1.2 2019/07/14 23:33:19 djm Exp $ */
+/* $OpenBSD: test_sshbuf_getput_basic.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
# include <stdint.h>
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c b/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
index 492b3bdf..e3620e97 100644
--- a/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
+++ b/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_sshbuf_getput_crypto.c,v 1.2 2019/01/21 12:29:35 djm Exp $ */
+/* $OpenBSD: test_sshbuf_getput_crypto.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
@@ -10,7 +10,6 @@
#ifdef WITH_OPENSSL
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
# include <stdint.h>
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c b/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
index 1ca30be9..5de8707c 100644
--- a/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
+++ b/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_sshbuf_getput_fuzz.c,v 1.4 2019/01/21 12:29:35 djm Exp $ */
+/* $OpenBSD: test_sshbuf_getput_fuzz.c,v 1.5 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
# include <stdint.h>
diff --git a/regress/unittests/sshbuf/test_sshbuf_misc.c b/regress/unittests/sshbuf/test_sshbuf_misc.c
index c53db937..249ecf23 100644
--- a/regress/unittests/sshbuf/test_sshbuf_misc.c
+++ b/regress/unittests/sshbuf/test_sshbuf_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_sshbuf_misc.c,v 1.4 2019/07/16 22:16:49 djm Exp $ */
+/* $OpenBSD: test_sshbuf_misc.c,v 1.5 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
# include <stdint.h>
diff --git a/regress/unittests/sshkey/common.c b/regress/unittests/sshkey/common.c
index effea578..51b0d92e 100644
--- a/regress/unittests/sshkey/common.c
+++ b/regress/unittests/sshkey/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.4 2020/01/26 00:09:50 djm Exp $ */
+/* $OpenBSD: common.c,v 1.5 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Helpers for key API tests
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
diff --git a/regress/unittests/sshkey/test_file.c b/regress/unittests/sshkey/test_file.c
index deb3ec12..497ab6dd 100644
--- a/regress/unittests/sshkey/test_file.c
+++ b/regress/unittests/sshkey/test_file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_file.c,v 1.9 2020/06/19 03:48:49 djm Exp $ */
+/* $OpenBSD: test_file.c,v 1.10 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshkey.h key management API
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
diff --git a/regress/unittests/sshkey/test_fuzz.c b/regress/unittests/sshkey/test_fuzz.c
index f111446a..a583c4a5 100644
--- a/regress/unittests/sshkey/test_fuzz.c
+++ b/regress/unittests/sshkey/test_fuzz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_fuzz.c,v 1.12 2020/08/27 03:55:22 djm Exp $ */
+/* $OpenBSD: test_fuzz.c,v 1.13 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Fuzz tests for key parsing
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
diff --git a/regress/unittests/sshkey/test_sshkey.c b/regress/unittests/sshkey/test_sshkey.c
index 7dc20cc8..1f5da68b 100644
--- a/regress/unittests/sshkey/test_sshkey.c
+++ b/regress/unittests/sshkey/test_sshkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_sshkey.c,v 1.21 2020/08/27 03:55:22 djm Exp $ */
+/* $OpenBSD: test_sshkey.c,v 1.22 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshkey.h key management API
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
diff --git a/regress/unittests/sshsig/tests.c b/regress/unittests/sshsig/tests.c
index 48db08bf..c44a9807 100644
--- a/regress/unittests/sshsig/tests.c
+++ b/regress/unittests/sshsig/tests.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tests.c,v 1.2 2020/06/22 06:00:06 djm Exp $ */
+/* $OpenBSD: tests.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
@@ -8,7 +8,6 @@
#include "includes.h"
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c
index 9014ce8e..de125fcd 100644
--- a/regress/unittests/test_helper/test_helper.c
+++ b/regress/unittests/test_helper/test_helper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_helper.c,v 1.12 2019/08/02 01:41:24 djm Exp $ */
+/* $OpenBSD: test_helper.c,v 1.13 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Copyright (c) 2011 Damien Miller <djm at mindrot.org>
*
@@ -44,6 +44,8 @@
# include <vis.h>
#endif
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
#include "entropy.h"
#include "test_helper.h"
#include "atomicio.h"
@@ -415,8 +417,8 @@ assert_mem(const char *file, int line, const char *a1, const char *a2,
r = memcmp(aa1, aa2, l);
TEST_CHECK_INT(r, pred);
test_header(file, line, a1, a2, "STRING", pred);
- aa1_tohex = tohex(aa1, MIN(l, 256));
- aa2_tohex = tohex(aa2, MIN(l, 256));
+ aa1_tohex = tohex(aa1, MINIMUM(l, 256));
+ aa2_tohex = tohex(aa2, MINIMUM(l, 256));
fprintf(stderr, "%12s = %s (len %zu)\n", a1, aa1_tohex, l);
fprintf(stderr, "%12s = %s (len %zu)\n", a2, aa2_tohex, l);
free(aa1_tohex);
@@ -455,7 +457,7 @@ assert_mem_filled(const char *file, int line, const char *a1,
r = memvalcmp(aa1, v, l, &where);
TEST_CHECK_INT(r, pred);
test_header(file, line, a1, NULL, "MEM_ZERO", pred);
- aa1_tohex = tohex(aa1, MIN(l, 20));
+ aa1_tohex = tohex(aa1, MINIMUM(l, 20));
fprintf(stderr, "%20s = %s%s (len %zu)\n", a1,
aa1_tohex, l > 20 ? "..." : "", l);
free(aa1_tohex);
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list