Wed Apr 24 15:47:12 2024 UTC (16d)
csh: add a helper definition for the reallocarray function


(nia)
diff -r1.29 -r1.30 src/bin/csh/csh.h

cvs diff -r1.29 -r1.30 src/bin/csh/csh.h (expand / switch to unified diff)

--- src/bin/csh/csh.h 2020/04/03 18:11:29 1.29
+++ src/bin/csh/csh.h 2024/04/24 15:47:11 1.30
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: csh.h,v 1.29 2020/04/03 18:11:29 joerg Exp $ */ 1/* $NetBSD: csh.h,v 1.30 2024/04/24 15:47:11 nia Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1980, 1991, 1993 4 * Copyright (c) 1980, 1991, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -76,26 +76,27 @@ typedef char Char; @@ -76,26 +76,27 @@ typedef char Char;
76 * Make sure a variable is not stored in a register by taking its address 76 * Make sure a variable is not stored in a register by taking its address
77 * This is used where variables might be clobbered by longjmp. 77 * This is used where variables might be clobbered by longjmp.
78 */ 78 */
79#define UNREGISTER(a) (void) &a 79#define UNREGISTER(a) (void) &a
80 80
81typedef void *ioctl_t; /* Third arg of ioctl */ 81typedef void *ioctl_t; /* Third arg of ioctl */
82 82
83#include "const.h" 83#include "const.h"
84#include "char.h" 84#include "char.h"
85#include "errnum.h" 85#include "errnum.h"
86 86
87#define xmalloc(i) Malloc(i) 87#define xmalloc(i) Malloc(i)
88#define xrealloc(p, i) Realloc(p, i) 88#define xrealloc(p, i) Realloc(p, i)
 89#define xreallocarray(p, n, sz) Reallocarray(p, n, sz)
89#define xcalloc(n, s) Calloc(n, s) 90#define xcalloc(n, s) Calloc(n, s)
90 91
91#include <stdio.h> 92#include <stdio.h>
92extern FILE *cshin, *cshout, *csherr; 93extern FILE *cshin, *cshout, *csherr;
93 94
94#define isdir(d) (S_ISDIR(d.st_mode)) 95#define isdir(d) (S_ISDIR(d.st_mode))
95 96
96#define eq(a, b) (Strcmp(a, b) == 0) 97#define eq(a, b) (Strcmp(a, b) == 0)
97 98
98/* globone() flags */ 99/* globone() flags */
99#define G_ERROR 0 /* default action: error if multiple words */ 100#define G_ERROR 0 /* default action: error if multiple words */
100#define G_IGNORE 1 /* ignore the rest of the words */ 101#define G_IGNORE 1 /* ignore the rest of the words */
101#define G_APPEND 2 /* make a sentence by cat'ing the words */ 102#define G_APPEND 2 /* make a sentence by cat'ing the words */