Skip to content

Commit 715c892

Browse files
committed
remove sys/param.h in -portable, after upstream
1 parent 7a7c69d commit 715c892

22 files changed

+13
-23
lines changed

atomicio.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
#include "includes.h"
3030

31-
#include <sys/param.h>
3231
#include <sys/uio.h>
3332

3433
#include <errno.h>

channels.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,7 @@ channel_handle_wfd(struct ssh *ssh, Channel *c,
20272027
#ifdef _AIX
20282028
/* XXX: Later AIX versions can't push as much data to tty */
20292029
if (c->wfd_isatty)
2030-
dlen = MIN(dlen, 8*1024);
2030+
dlen = MINIMUM(dlen, 8*1024);
20312031
#endif
20322032

20332033
len = write(c->wfd, buf, dlen);

includes.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#endif
2424

2525
#include <sys/types.h>
26-
#include <sys/param.h>
2726
#include <sys/socket.h> /* For CMSG_* */
2827

2928
#ifdef HAVE_LIMITS_H

loginrec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@
181181
#include "auth.h"
182182
#include "sshbuf.h"
183183
#include "ssherr.h"
184+
#include "misc.h"
184185

185186
#ifdef HAVE_UTIL_H
186187
# include <util.h>
@@ -801,7 +802,7 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx)
801802
# endif
802803
# ifdef HAVE_SYSLEN_IN_UTMPX
803804
/* ut_syslen is the length of the utx_host string */
804-
utx->ut_syslen = MIN(strlen(li->hostname), sizeof(utx->ut_host));
805+
utx->ut_syslen = MINIMUM(strlen(li->hostname), sizeof(utx->ut_host));
805806
# endif
806807
}
807808
#endif /* USE_UTMPX || USE_WTMPX */

openbsd-compat/arc4random.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
#ifndef HAVE_ARC4RANDOM
4141

42+
#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
43+
4244
#ifdef WITH_OPENSSL
4345
#include <openssl/rand.h>
4446
#include <openssl/err.h>
@@ -170,7 +172,7 @@ _rs_rekey(u_char *dat, size_t datlen)
170172
if (dat) {
171173
size_t i, m;
172174

173-
m = MIN(datlen, KEYSZ + IVSZ);
175+
m = MINIMUM(datlen, KEYSZ + IVSZ);
174176
for (i = 0; i < m; i++)
175177
rs_buf[i] ^= dat[i];
176178
}
@@ -189,7 +191,7 @@ _rs_random_buf(void *_buf, size_t n)
189191
_rs_stir_if_needed(n);
190192
while (n > 0) {
191193
if (rs_have > 0) {
192-
m = MIN(n, rs_have);
194+
m = MINIMUM(n, rs_have);
193195
memcpy(buf, rs_buf + RSBUFSZ - rs_have, m);
194196
memset(rs_buf + RSBUFSZ - rs_have, 0, m);
195197
buf += m;
@@ -230,7 +232,7 @@ arc4random_addrandom(u_char *dat, int datlen)
230232
if (!rs_initialized)
231233
_rs_stir();
232234
while (datlen > 0) {
233-
m = MIN(datlen, KEYSZ + IVSZ);
235+
m = MINIMUM(datlen, KEYSZ + IVSZ);
234236
_rs_rekey(dat, m);
235237
dat += m;
236238
datlen -= m;

openbsd-compat/base64.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
#if (!defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP)) || (!defined(HAVE_B64_PTON) && !defined(HAVE___B64_PTON))
5050

5151
#include <sys/types.h>
52-
#include <sys/param.h>
5352
#include <sys/socket.h>
5453
#include <netinet/in.h>
5554
#include <arpa/inet.h>

openbsd-compat/bcrypt_pbkdf.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#ifndef HAVE_BCRYPT_PBKDF
2525

2626
#include <sys/types.h>
27-
#include <sys/param.h>
2827

2928
#ifdef HAVE_STDLIB_H
3029
# include <stdlib.h>

openbsd-compat/bsd-closefrom.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#if !defined(HAVE_CLOSEFROM) || defined(BROKEN_CLOSEFROM)
2020

2121
#include <sys/types.h>
22-
#include <sys/param.h>
2322
#include <unistd.h>
2423
#include <stdio.h>
2524
#ifdef HAVE_FCNTL_H

openbsd-compat/bsd-statvfs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#if !defined(HAVE_STATVFS) || !defined(HAVE_FSTATVFS)
2020

21-
#include <sys/param.h>
2221
#ifdef HAVE_SYS_MOUNT_H
2322
# include <sys/mount.h>
2423
#endif

openbsd-compat/dirname.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
#include <errno.h>
2525
#include <string.h>
26-
#include <sys/param.h>
2726

2827
char *
2928
dirname(const char *path)

openbsd-compat/getcwd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
#if !defined(HAVE_GETCWD)
3636

37-
#include <sys/param.h>
3837
#include <sys/stat.h>
3938
#include <errno.h>
4039
#include <dirent.h>

openbsd-compat/inet_aton.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
#if !defined(HAVE_INET_ATON)
5757

5858
#include <sys/types.h>
59-
#include <sys/param.h>
6059
#include <netinet/in.h>
6160
#include <arpa/inet.h>
6261
#include <ctype.h>

openbsd-compat/inet_ntop.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
#ifndef HAVE_INET_NTOP
2424

25-
#include <sys/param.h>
2625
#include <sys/types.h>
2726
#include <sys/socket.h>
2827
#include <netinet/in.h>

openbsd-compat/port-solaris.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include <sys/types.h>
2121
#include <sys/stat.h>
22-
#include <sys/param.h>
2322

2423
#include <errno.h>
2524
#ifdef HAVE_FCNTL_H

openbsd-compat/xcrypt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
# define crypt DES_crypt
6060
# endif
6161

62+
#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
63+
6264
/*
6365
* Pick an appropriate password encryption type and salt for the running
6466
* system by searching through accounts until we find one that has a valid
@@ -82,7 +84,7 @@ pick_salt(void)
8284
continue;
8385
if (passwd[0] == '$' && (p = strrchr(passwd+1, '$')) != NULL) {
8486
typelen = p - passwd + 1;
85-
strlcpy(salt, passwd, MIN(typelen, sizeof(salt)));
87+
strlcpy(salt, passwd, MINIMUM(typelen, sizeof(salt)));
8688
explicit_bzero(passwd, strlen(passwd));
8789
goto out;
8890
}

regress/misc/fuzz-harness/kex_fuzz.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
#include <sys/types.h>
5-
#include <sys/param.h>
65
#include <stdio.h>
76
#include <stdint.h>
87
#include <stdlib.h>

regress/unittests/sshbuf/test_sshbuf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323

2424
void sshbuf_tests(void);
2525

26+
#ifndef roundup
2627
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
28+
#endif
2729

2830
void
2931
sshbuf_tests(void)

regress/unittests/test_helper/test_helper.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "includes.h"
2121

2222
#include <sys/types.h>
23-
#include <sys/param.h>
2423
#include <sys/uio.h>
2524

2625
#include <stdarg.h>

sandbox-capsicum.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#ifdef SANDBOX_CAPSICUM
2020

2121
#include <sys/types.h>
22-
#include <sys/param.h>
2322
#include <sys/time.h>
2423
#include <sys/resource.h>
2524
#include <sys/capsicum.h>

session.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "includes.h"
3737

3838
#include <sys/types.h>
39-
#include <sys/param.h>
4039
#ifdef HAVE_SYS_STAT_H
4140
# include <sys/stat.h>
4241
#endif

sftp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#ifdef HAVE_SYS_STAT_H
2323
# include <sys/stat.h>
2424
#endif
25-
#include <sys/param.h>
2625
#include <sys/socket.h>
2726
#include <sys/wait.h>
2827
#ifdef HAVE_SYS_STATVFS_H

ssh-agent.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include "includes.h"
3838

3939
#include <sys/types.h>
40-
#include <sys/param.h>
4140
#include <sys/resource.h>
4241
#include <sys/stat.h>
4342
#include <sys/socket.h>

0 commit comments

Comments
 (0)