summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmcc <mmcc@openbsd.org>2015-12-07 20:39:19 +0000
committermmcc <mmcc@openbsd.org>2015-12-07 20:39:19 +0000
commit54d5890cbe1121890bca78a4671e0cee26be0f00 (patch)
treea2e267e478d49ec5f1a28520b02abddc7c61c9a2
parentNo need to check for NULL before free(). (diff)
downloadwireguard-openbsd-54d5890cbe1121890bca78a4671e0cee26be0f00.tar.xz
wireguard-openbsd-54d5890cbe1121890bca78a4671e0cee26be0f00.zip
Remove needless type casts and corresponding type parameters from
allocation macros. No binary change. ok tb@
-rw-r--r--usr.bin/vi/cl/cl_main.c6
-rw-r--r--usr.bin/vi/cl/cl_screen.c4
-rw-r--r--usr.bin/vi/common/cut.c8
-rw-r--r--usr.bin/vi/common/exf.c8
-rw-r--r--usr.bin/vi/common/main.c6
-rw-r--r--usr.bin/vi/common/mark.c4
-rw-r--r--usr.bin/vi/common/mem.h49
-rw-r--r--usr.bin/vi/common/screen.c6
-rw-r--r--usr.bin/vi/common/seq.c4
-rw-r--r--usr.bin/vi/common/util.c6
-rw-r--r--usr.bin/vi/ex/ex_args.c6
-rw-r--r--usr.bin/vi/ex/ex_argv.c10
-rw-r--r--usr.bin/vi/ex/ex_at.c8
-rw-r--r--usr.bin/vi/ex/ex_global.c10
-rw-r--r--usr.bin/vi/ex/ex_init.c6
-rw-r--r--usr.bin/vi/ex/ex_script.c6
-rw-r--r--usr.bin/vi/ex/ex_source.c4
-rw-r--r--usr.bin/vi/ex/ex_subst.c10
-rw-r--r--usr.bin/vi/ex/ex_tag.c20
-rw-r--r--usr.bin/vi/vi/v_init.c6
-rw-r--r--usr.bin/vi/vi/v_paragraph.c4
-rw-r--r--usr.bin/vi/vi/vi.c4
-rw-r--r--usr.bin/vi/vi/vs_msg.c6
-rw-r--r--usr.bin/vi/vi/vs_split.c6
24 files changed, 100 insertions, 107 deletions
diff --git a/usr.bin/vi/cl/cl_main.c b/usr.bin/vi/cl/cl_main.c
index b5e8634f5e0..f5660931acb 100644
--- a/usr.bin/vi/cl/cl_main.c
+++ b/usr.bin/vi/cl/cl_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl_main.c,v 1.26 2015/03/29 01:04:23 bcallah Exp $ */
+/* $OpenBSD: cl_main.c,v 1.27 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -151,7 +151,7 @@ gs_init(char *name)
name = p + 1;
/* Allocate the global structure. */
- CALLOC_NOMSG(NULL, gp, GS *, 1, sizeof(GS));
+ CALLOC_NOMSG(NULL, gp, 1, sizeof(GS));
if (gp == NULL)
perr(name, NULL);
@@ -171,7 +171,7 @@ cl_init(GS *gp)
int fd;
/* Allocate the CL private structure. */
- CALLOC_NOMSG(NULL, clp, CL_PRIVATE *, 1, sizeof(CL_PRIVATE));
+ CALLOC_NOMSG(NULL, clp, 1, sizeof(CL_PRIVATE));
if (clp == NULL)
perr(gp->progname, NULL);
gp->cl_private = clp;
diff --git a/usr.bin/vi/cl/cl_screen.c b/usr.bin/vi/cl/cl_screen.c
index 6fafff1f849..04f301f9cd4 100644
--- a/usr.bin/vi/cl/cl_screen.c
+++ b/usr.bin/vi/cl/cl_screen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl_screen.c,v 1.23 2015/04/10 18:05:51 brynet Exp $ */
+/* $OpenBSD: cl_screen.c,v 1.24 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -502,7 +502,7 @@ cl_getcap(SCR *sp, char *name, char **elementp)
if ((t = tigetstr(name)) != NULL &&
t != (char *)-1 && (len = strlen(t)) != 0) {
- MALLOC_RET(sp, *elementp, char *, len + 1);
+ MALLOC_RET(sp, *elementp, len + 1);
memmove(*elementp, t, len + 1);
}
return (0);
diff --git a/usr.bin/vi/common/cut.c b/usr.bin/vi/common/cut.c
index 0b9c77d4da9..6dc4549a444 100644
--- a/usr.bin/vi/common/cut.c
+++ b/usr.bin/vi/common/cut.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cut.c,v 1.13 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: cut.c,v 1.14 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -119,7 +119,7 @@ copyloop:
* Otherwise, if it's not an append, free its current contents.
*/
if (cbp == NULL) {
- CALLOC_RET(sp, cbp, CB *, 1, sizeof(CB));
+ CALLOC_RET(sp, cbp, 1, sizeof(CB));
cbp->name = name;
TAILQ_INIT(&cbp->textq);
LIST_INSERT_HEAD(&sp->gp->cutq, cbp, q);
@@ -300,12 +300,12 @@ text_init(SCR *sp, const char *p, size_t len, size_t total_len)
{
TEXT *tp;
- CALLOC(sp, tp, TEXT *, 1, sizeof(TEXT));
+ CALLOC(sp, tp, 1, sizeof(TEXT));
if (tp == NULL)
return (NULL);
/* ANSI C doesn't define a call to malloc(3) for 0 bytes. */
if ((tp->lb_len = total_len) != 0) {
- MALLOC(sp, tp->lb, CHAR_T *, tp->lb_len);
+ MALLOC(sp, tp->lb, tp->lb_len);
if (tp->lb == NULL) {
free(tp);
return (NULL);
diff --git a/usr.bin/vi/common/exf.c b/usr.bin/vi/common/exf.c
index 863eb0f4774..55beae26f9f 100644
--- a/usr.bin/vi/common/exf.c
+++ b/usr.bin/vi/common/exf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exf.c,v 1.38 2015/11/19 07:53:31 bentley Exp $ */
+/* $OpenBSD: exf.c,v 1.39 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -86,7 +86,7 @@ file_add(SCR *sp, CHAR_T *name)
}
/* Allocate and initialize the FREF structure. */
- CALLOC(sp, frp, FREF *, 1, sizeof(FREF));
+ CALLOC(sp, frp, 1, sizeof(FREF));
if (frp == NULL)
return (NULL);
@@ -153,7 +153,7 @@ file_init(SCR *sp, FREF *frp, char *rcv_name, int flags)
* Default recover mail file fd to -1.
* Set initial EXF flag bits.
*/
- CALLOC_RET(sp, ep, EXF *, 1, sizeof(EXF));
+ CALLOC_RET(sp, ep, 1, sizeof(EXF));
ep->c_lno = ep->c_nlines = OOBLNO;
ep->rcv_fd = ep->fcntl_fd = -1;
F_SET(ep, F_FIRSTMODIFY);
@@ -495,7 +495,7 @@ file_spath(SCR *sp, FREF *frp, struct stat *sbp, int *existsp)
/* If we found it, build a new pathname and discard the old one. */
if (found) {
- MALLOC_RET(sp, p, char *, len + 1);
+ MALLOC_RET(sp, p, len + 1);
memcpy(p, path, len + 1);
free(frp->name);
frp->name = p;
diff --git a/usr.bin/vi/common/main.c b/usr.bin/vi/common/main.c
index 4669fd3541d..541864a9fed 100644
--- a/usr.bin/vi/common/main.c
+++ b/usr.bin/vi/common/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.30 2015/11/20 04:12:19 bentley Exp $ */
+/* $OpenBSD: main.c,v 1.31 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -360,7 +360,7 @@ editor(GS *gp, int argc, char *argv[])
size_t l;
/* Cheat -- we know we have an extra argv slot. */
l = strlen(sp->frp->name) + 1;
- MALLOC_NOMSG(sp, *--argv, char *, l);
+ MALLOC_NOMSG(sp, *--argv, l);
if (*argv == NULL) {
v_estr(gp->progname, errno, NULL);
goto err;
@@ -563,7 +563,7 @@ v_obsolete(char *name, char *argv[])
} else {
p = argv[0];
len = strlen(argv[0]);
- MALLOC_NOMSG(NULL, argv[0], char *, len + 2);
+ MALLOC_NOMSG(NULL, argv[0], len + 2);
if (argv[0] == NULL)
goto nomem;
argv[0][0] = '-';
diff --git a/usr.bin/vi/common/mark.c b/usr.bin/vi/common/mark.c
index b845e47647a..a7e9754043f 100644
--- a/usr.bin/vi/common/mark.c
+++ b/usr.bin/vi/common/mark.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mark.c,v 1.9 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: mark.c,v 1.10 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -160,7 +160,7 @@ mark_set(SCR *sp, ARG_CHAR_T key, MARK *value, int userset)
*/
lmp = mark_find(sp, key);
if (lmp == NULL || lmp->name != key) {
- MALLOC_RET(sp, lmt, LMARK *, sizeof(LMARK));
+ MALLOC_RET(sp, lmt, sizeof(LMARK));
if (lmp == NULL) {
LIST_INSERT_HEAD(&sp->ep->marks, lmt, q);
} else
diff --git a/usr.bin/vi/common/mem.h b/usr.bin/vi/common/mem.h
index 817329fca58..63cfcd23799 100644
--- a/usr.bin/vi/common/mem.h
+++ b/usr.bin/vi/common/mem.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.h,v 1.6 2014/10/14 22:23:12 deraadt Exp $ */
+/* $OpenBSD: mem.h,v 1.7 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -111,57 +111,50 @@
/*
* Malloc a buffer, casting the return pointer. Various versions.
- *
- * !!!
- * The cast should be unnecessary, malloc(3) and friends return void *'s,
- * which is all we need. However, some systems that nvi needs to run on
- * don't do it right yet, resulting in the compiler printing out roughly
- * a million warnings. After awhile, it seemed easier to put the casts
- * in instead of explaining it all the time.
*/
-#define CALLOC(sp, p, cast, nmemb, size) { \
- if (((p) = (cast)calloc((nmemb), (size))) == NULL) \
+#define CALLOC(sp, p, nmemb, size) { \
+ if (((p) = calloc((nmemb), (size))) == NULL) \
msgq((sp), M_SYSERR, NULL); \
}
-#define CALLOC_GOTO(sp, p, cast, nmemb, size) { \
- if (((p) = (cast)calloc((nmemb), (size))) == NULL) \
+#define CALLOC_GOTO(sp, p, nmemb, size) { \
+ if (((p) = calloc((nmemb), (size))) == NULL) \
goto alloc_err; \
}
-#define CALLOC_NOMSG(sp, p, cast, nmemb, size) { \
- (p) = (cast)calloc((nmemb), (size)); \
+#define CALLOC_NOMSG(sp, p, nmemb, size) { \
+ (p) = calloc((nmemb), (size)); \
}
-#define CALLOC_RET(sp, p, cast, nmemb, size) { \
- if (((p) = (cast)calloc((nmemb), (size))) == NULL) { \
+#define CALLOC_RET(sp, p, nmemb, size) { \
+ if (((p) = calloc((nmemb), (size))) == NULL) { \
msgq((sp), M_SYSERR, NULL); \
return (1); \
} \
}
-#define MALLOC(sp, p, cast, size) { \
- if (((p) = (cast)malloc(size)) == NULL) \
+#define MALLOC(sp, p, size) { \
+ if (((p) = malloc(size)) == NULL) \
msgq((sp), M_SYSERR, NULL); \
}
-#define MALLOC_GOTO(sp, p, cast, size) { \
- if (((p) = (cast)malloc(size)) == NULL) \
+#define MALLOC_GOTO(sp, p, size) { \
+ if (((p) = malloc(size)) == NULL) \
goto alloc_err; \
}
-#define MALLOC_NOMSG(sp, p, cast, size) { \
- (p) = (cast)malloc(size); \
+#define MALLOC_NOMSG(sp, p, size) { \
+ (p) = malloc(size); \
}
-#define MALLOC_RET(sp, p, cast, size) { \
- if (((p) = (cast)malloc(size)) == NULL) { \
+#define MALLOC_RET(sp, p, size) { \
+ if (((p) = malloc(size)) == NULL) { \
msgq((sp), M_SYSERR, NULL); \
return (1); \
} \
}
-#define REALLOC(sp, p, cast, size) { \
- if (((p) = (cast)(realloc((p), (size)))) == NULL) \
+#define REALLOC(sp, p, size) { \
+ if (((p) = (realloc((p), (size)))) == NULL) \
msgq((sp), M_SYSERR, NULL); \
}
-#define REALLOCARRAY(sp, p, cast, nelem, size) { \
- if (((p) = (cast)(reallocarray((p), (nelem), (size)))) == NULL) \
+#define REALLOCARRAY(sp, p, nelem, size) { \
+ if (((p) = (reallocarray((p), (nelem), (size)))) == NULL) \
msgq((sp), M_SYSERR, NULL); \
}
diff --git a/usr.bin/vi/common/screen.c b/usr.bin/vi/common/screen.c
index 0c926cfb308..701b87c2c25 100644
--- a/usr.bin/vi/common/screen.c
+++ b/usr.bin/vi/common/screen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen.c,v 1.12 2014/11/20 08:50:53 bentley Exp $ */
+/* $OpenBSD: screen.c,v 1.13 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -39,7 +39,7 @@ screen_init(GS *gp, SCR *orig, SCR **spp)
size_t len;
*spp = NULL;
- CALLOC_RET(orig, sp, SCR *, 1, sizeof(SCR));
+ CALLOC_RET(orig, sp, 1, sizeof(SCR));
*spp = sp;
/* INITIALIZED AT SCREEN CREATE. */
@@ -89,7 +89,7 @@ screen_init(GS *gp, SCR *orig, SCR **spp)
sp->repl_len = orig->repl_len;
if (orig->newl_len) {
len = orig->newl_len * sizeof(size_t);
- MALLOC(sp, sp->newl, size_t *, len);
+ MALLOC(sp, sp->newl, len);
if (sp->newl == NULL) {
mem: msgq(orig, M_SYSERR, NULL);
goto err;
diff --git a/usr.bin/vi/common/seq.c b/usr.bin/vi/common/seq.c
index 9eb933fdc85..2703d180d50 100644
--- a/usr.bin/vi/common/seq.c
+++ b/usr.bin/vi/common/seq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: seq.c,v 1.10 2015/01/16 06:40:14 deraadt Exp $ */
+/* $OpenBSD: seq.c,v 1.11 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -66,7 +66,7 @@ seq_set(SCR *sp, CHAR_T *name, size_t nlen, CHAR_T *input, size_t ilen,
}
/* Allocate and initialize SEQ structure. */
- CALLOC(sp, qp, SEQ *, 1, sizeof(SEQ));
+ CALLOC(sp, qp, 1, sizeof(SEQ));
if (qp == NULL) {
sv_errno = errno;
goto mem1;
diff --git a/usr.bin/vi/common/util.c b/usr.bin/vi/common/util.c
index 8ce16e011d0..ffb3a27f7d8 100644
--- a/usr.bin/vi/common/util.c
+++ b/usr.bin/vi/common/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.11 2015/03/28 12:54:37 bcallah Exp $ */
+/* $OpenBSD: util.c,v 1.12 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -42,7 +42,7 @@ binc(SCR *sp, void *bp, size_t *bsizep, size_t min)
return (bp);
csize = *bsizep + MAXIMUM(min, 256);
- REALLOC(sp, bp, void *, csize);
+ REALLOC(sp, bp, csize);
if (bp == NULL) {
/*
@@ -123,7 +123,7 @@ v_strdup(SCR *sp, const CHAR_T *str, size_t len)
{
CHAR_T *copy;
- MALLOC(sp, copy, CHAR_T *, len + 1);
+ MALLOC(sp, copy, len + 1);
if (copy == NULL)
return (NULL);
memcpy(copy, str, len * sizeof(CHAR_T));
diff --git a/usr.bin/vi/ex/ex_args.c b/usr.bin/vi/ex/ex_args.c
index 03d7d5da709..5293d067f6c 100644
--- a/usr.bin/vi/ex/ex_args.c
+++ b/usr.bin/vi/ex/ex_args.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_args.c,v 1.10 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: ex_args.c,v 1.11 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -82,7 +82,7 @@ ex_next(SCR *sp, EXCMD *cmdp)
/* Create a new list. */
CALLOC_RET(sp,
- sp->argv, char **, cmdp->argc + 1, sizeof(char *));
+ sp->argv, cmdp->argc + 1, sizeof(char *));
for (ap = sp->argv,
argv = cmdp->argv; argv[0]->len != 0; ++ap, ++argv)
if ((*ap =
@@ -292,7 +292,7 @@ ex_buildargv(SCR *sp, EXCMD *cmdp, char *name)
char **ap, **s_argv;
argc = cmdp == NULL ? 1 : cmdp->argc;
- CALLOC(sp, s_argv, char **, argc + 1, sizeof(char *));
+ CALLOC(sp, s_argv, argc + 1, sizeof(char *));
if ((ap = s_argv) == NULL)
return (NULL);
diff --git a/usr.bin/vi/ex/ex_argv.c b/usr.bin/vi/ex/ex_argv.c
index a882d3362dd..051de1e2be3 100644
--- a/usr.bin/vi/ex/ex_argv.c
+++ b/usr.bin/vi/ex/ex_argv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_argv.c,v 1.16 2014/11/12 16:29:04 millert Exp $ */
+/* $OpenBSD: ex_argv.c,v 1.17 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -404,7 +404,7 @@ argv_alloc(SCR *sp, size_t len)
off = exp->argsoff;
if (exp->argscnt == 0 || off + 2 >= exp->argscnt - 1) {
cnt = exp->argscnt + INCREMENT;
- REALLOCARRAY(sp, exp->args, ARGS **, cnt, sizeof(ARGS *));
+ REALLOCARRAY(sp, exp->args, cnt, sizeof(ARGS *));
if (exp->args == NULL) {
(void)argv_free(sp);
goto mem;
@@ -415,7 +415,7 @@ argv_alloc(SCR *sp, size_t len)
/* First argument. */
if (exp->args[off] == NULL) {
- CALLOC(sp, exp->args[off], ARGS *, 1, sizeof(ARGS));
+ CALLOC(sp, exp->args[off], 1, sizeof(ARGS));
if (exp->args[off] == NULL)
goto mem;
}
@@ -425,7 +425,7 @@ argv_alloc(SCR *sp, size_t len)
ap->len = 0;
if (ap->blen < len + 1) {
ap->blen = len + 1;
- REALLOCARRAY(sp, ap->bp, CHAR_T *, ap->blen, sizeof(CHAR_T));
+ REALLOCARRAY(sp, ap->bp, ap->blen, sizeof(CHAR_T));
if (ap->bp == NULL) {
ap->bp = NULL;
ap->blen = 0;
@@ -438,7 +438,7 @@ mem: msgq(sp, M_SYSERR, NULL);
/* Second argument. */
if (exp->args[++off] == NULL) {
- CALLOC(sp, exp->args[off], ARGS *, 1, sizeof(ARGS));
+ CALLOC(sp, exp->args[off], 1, sizeof(ARGS));
if (exp->args[off] == NULL)
goto mem;
}
diff --git a/usr.bin/vi/ex/ex_at.c b/usr.bin/vi/ex/ex_at.c
index a30c4108411..dca3fe6e16b 100644
--- a/usr.bin/vi/ex/ex_at.c
+++ b/usr.bin/vi/ex/ex_at.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_at.c,v 1.11 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: ex_at.c,v 1.12 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -79,9 +79,9 @@ ex_at(SCR *sp, EXCMD *cmdp)
* the range, continue to execute after a file/screen switch, which
* means @ buffers are still useful in a multi-screen environment.
*/
- CALLOC_RET(sp, ecp, EXCMD *, 1, sizeof(EXCMD));
+ CALLOC_RET(sp, ecp, 1, sizeof(EXCMD));
TAILQ_INIT(&ecp->rq);
- CALLOC_RET(sp, rp, RANGE *, 1, sizeof(RANGE));
+ CALLOC_RET(sp, rp, 1, sizeof(RANGE));
rp->start = cmdp->addr1.lno;
if (F_ISSET(cmdp, E_ADDR_DEF)) {
rp->stop = rp->start;
@@ -105,7 +105,7 @@ ex_at(SCR *sp, EXCMD *cmdp)
len += tp->len + 1;
}
- MALLOC_RET(sp, ecp->cp, char *, len * 2);
+ MALLOC_RET(sp, ecp->cp, len * 2);
ecp->o_cp = ecp->cp;
ecp->o_clen = len;
ecp->cp[len] = '\0';
diff --git a/usr.bin/vi/ex/ex_global.c b/usr.bin/vi/ex/ex_global.c
index 2c9b4077a6d..8c5def6b3a1 100644
--- a/usr.bin/vi/ex/ex_global.c
+++ b/usr.bin/vi/ex/ex_global.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_global.c,v 1.13 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: ex_global.c,v 1.14 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -155,7 +155,7 @@ usage: ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
return (1);
/* Get an EXCMD structure. */
- CALLOC_RET(sp, ecp, EXCMD *, 1, sizeof(EXCMD));
+ CALLOC_RET(sp, ecp, 1, sizeof(EXCMD));
TAILQ_INIT(&ecp->rq);
/*
@@ -170,7 +170,7 @@ usage: ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
len = 1;
}
- MALLOC_RET(sp, ecp->cp, char *, len * 2);
+ MALLOC_RET(sp, ecp->cp, len * 2);
ecp->o_cp = ecp->cp;
ecp->o_clen = len;
memcpy(ecp->cp + len, p, len);
@@ -231,7 +231,7 @@ usage: ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
}
/* Allocate a new range, and append it to the list. */
- CALLOC(sp, rp, RANGE *, 1, sizeof(RANGE));
+ CALLOC(sp, rp, 1, sizeof(RANGE));
if (rp == NULL)
return (1);
rp->start = rp->stop = start;
@@ -297,7 +297,7 @@ ex_g_insdel(SCR *sp, lnop_t op, recno_t lno)
free(rp);
}
} else {
- CALLOC_RET(sp, nrp, RANGE *, 1, sizeof(RANGE));
+ CALLOC_RET(sp, nrp, 1, sizeof(RANGE));
nrp->start = lno + 1;
nrp->stop = rp->stop + 1;
rp->stop = lno - 1;
diff --git a/usr.bin/vi/ex/ex_init.c b/usr.bin/vi/ex/ex_init.c
index 2ea64dae335..f816d6f58b7 100644
--- a/usr.bin/vi/ex/ex_init.c
+++ b/usr.bin/vi/ex/ex_init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_init.c,v 1.15 2015/11/19 07:53:31 bentley Exp $ */
+/* $OpenBSD: ex_init.c,v 1.16 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -44,7 +44,7 @@ ex_screen_copy(SCR *orig, SCR *sp)
EX_PRIVATE *oexp, *nexp;
/* Create the private ex structure. */
- CALLOC_RET(orig, nexp, EX_PRIVATE *, 1, sizeof(EX_PRIVATE));
+ CALLOC_RET(orig, nexp, 1, sizeof(EX_PRIVATE));
sp->ex_private = nexp;
/* Initialize queues. */
@@ -272,7 +272,7 @@ ex_run_str(SCR *sp, char *name, char *str, size_t len, int ex_flags,
gp = sp->gp;
if (EXCMD_RUNNING(gp)) {
- CALLOC_RET(sp, ecp, EXCMD *, 1, sizeof(EXCMD));
+ CALLOC_RET(sp, ecp, 1, sizeof(EXCMD));
LIST_INSERT_HEAD(&gp->ecq, ecp, q);
} else
ecp = &gp->excmd;
diff --git a/usr.bin/vi/ex/ex_script.c b/usr.bin/vi/ex/ex_script.c
index 67f0c5455b6..d2c0ad603e2 100644
--- a/usr.bin/vi/ex/ex_script.c
+++ b/usr.bin/vi/ex/ex_script.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_script.c,v 1.21 2014/11/12 16:29:04 millert Exp $ */
+/* $OpenBSD: ex_script.c,v 1.22 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -88,7 +88,7 @@ sscr_init(SCR *sp)
if (opts_empty(sp, O_SHELL, 0))
return (1);
- MALLOC_RET(sp, sc, SCRIPT *, sizeof(SCRIPT));
+ MALLOC_RET(sp, sc, sizeof(SCRIPT));
sp->script = sc;
sc->sh_prompt = NULL;
sc->sh_prompt_len = 0;
@@ -572,7 +572,7 @@ sscr_setprompt(SCR *sp, char *buf, size_t len)
sc = sp->script;
if (sc->sh_prompt)
free(sc->sh_prompt);
- MALLOC(sp, sc->sh_prompt, char *, len + 1);
+ MALLOC(sp, sc->sh_prompt, len + 1);
if (sc->sh_prompt == NULL) {
sscr_end(sp);
return (1);
diff --git a/usr.bin/vi/ex/ex_source.c b/usr.bin/vi/ex/ex_source.c
index 47688f49d13..acd1659d1a8 100644
--- a/usr.bin/vi/ex/ex_source.c
+++ b/usr.bin/vi/ex/ex_source.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_source.c,v 1.9 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: ex_source.c,v 1.10 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -58,7 +58,7 @@ ex_sourcefd(SCR *sp, EXCMD *cmdp, int fd)
goto err;
}
- MALLOC(sp, bp, char *, (size_t)sb.st_size + 1);
+ MALLOC(sp, bp, (size_t)sb.st_size + 1);
if (bp == NULL) {
(void)close(fd);
return (1);
diff --git a/usr.bin/vi/ex/ex_subst.c b/usr.bin/vi/ex/ex_subst.c
index cc538050990..f05a61210d0 100644
--- a/usr.bin/vi/ex/ex_subst.c
+++ b/usr.bin/vi/ex/ex_subst.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_subst.c,v 1.23 2015/11/19 07:53:31 bentley Exp $ */
+/* $OpenBSD: ex_subst.c,v 1.24 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -301,7 +301,7 @@ ex_subtilde(SCR *sp, EXCMD *cmdp)
#define NEEDNEWLINE(sp) { \
if ((sp)->newl_len == (sp)->newl_cnt) { \
(sp)->newl_len += 25; \
- REALLOCARRAY((sp), (sp)->newl, size_t *, \
+ REALLOCARRAY((sp), (sp)->newl, \
(sp)->newl_len, sizeof(size_t)); \
if ((sp)->newl == NULL) { \
(sp)->newl_len = 0; \
@@ -313,7 +313,7 @@ ex_subtilde(SCR *sp, EXCMD *cmdp)
#define BUILD(sp, l, len) { \
if (lbclen + (len) > lblen) { \
lblen += MAXIMUM(lbclen + (len), 256); \
- REALLOC((sp), lb, char *, lblen); \
+ REALLOC((sp), lb, lblen); \
if (lb == NULL) { \
lbclen = 0; \
return (1); \
@@ -326,7 +326,7 @@ ex_subtilde(SCR *sp, EXCMD *cmdp)
#define NEEDSP(sp, len, pnt) { \
if (lbclen + (len) > lblen) { \
lblen += MAXIMUM(lbclen + (len), 256); \
- REALLOC((sp), lb, char *, lblen); \
+ REALLOC((sp), lb, lblen); \
if (lb == NULL) { \
lbclen = 0; \
return (1); \
@@ -939,7 +939,7 @@ re_compile(SCR *sp, char *ptrn, size_t plen, char **ptrnp, size_t *lenp,
* Regcomp isn't 8-bit clean, so the pattern is nul-terminated
* for now. There's just no other solution.
*/
- MALLOC(sp, *ptrnp, char *, plen + 1);
+ MALLOC(sp, *ptrnp, plen + 1);
if (*ptrnp != NULL) {
memcpy(*ptrnp, ptrn, plen);
(*ptrnp)[plen] = '\0';
diff --git a/usr.bin/vi/ex/ex_tag.c b/usr.bin/vi/ex/ex_tag.c
index 69a62e18f23..26e1cb02782 100644
--- a/usr.bin/vi/ex/ex_tag.c
+++ b/usr.bin/vi/ex/ex_tag.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_tag.c,v 1.22 2015/11/19 07:53:31 bentley Exp $ */
+/* $OpenBSD: ex_tag.c,v 1.23 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -137,11 +137,11 @@ ex_tag_push(SCR *sp, EXCMD *cmdp)
rtqp = NULL;
if (TAILQ_EMPTY(&exp->tq)) {
/* Initialize the `local context' tag queue structure. */
- CALLOC_GOTO(sp, rtqp, TAGQ *, 1, sizeof(TAGQ));
+ CALLOC_GOTO(sp, rtqp, 1, sizeof(TAGQ));
TAILQ_INIT(&rtqp->tagq);
/* Initialize and link in its tag structure. */
- CALLOC_GOTO(sp, rtp, TAG *, 1, sizeof(TAG));
+ CALLOC_GOTO(sp, rtp, 1, sizeof(TAG));
TAILQ_INSERT_HEAD(&rtqp->tagq, rtp, q);
rtqp->current = rtp;
}
@@ -661,7 +661,7 @@ tagf_copy(SCR *sp, TAGF *otfp, TAGF **tfpp)
{
TAGF *tfp;
- MALLOC_RET(sp, tfp, TAGF *, sizeof(TAGF));
+ MALLOC_RET(sp, tfp, sizeof(TAGF));
*tfp = *otfp;
/* XXX: Allocate as part of the TAGF structure!!! */
@@ -687,7 +687,7 @@ tagq_copy(SCR *sp, TAGQ *otqp, TAGQ **tqpp)
len = sizeof(TAGQ);
if (otqp->tag != NULL)
len += otqp->tlen + 1;
- MALLOC_RET(sp, tqp, TAGQ *, len);
+ MALLOC_RET(sp, tqp, len);
memcpy(tqp, otqp, len);
TAILQ_INIT(&tqp->tagq);
@@ -714,7 +714,7 @@ tag_copy(SCR *sp, TAG *otp, TAG **tpp)
len += otp->fnlen + 1;
if (otp->search != NULL)
len += otp->slen + 1;
- MALLOC_RET(sp, tp, TAG *, len);
+ MALLOC_RET(sp, tp, len);
memcpy(tp, otp, len);
if (otp->fname != NULL)
@@ -823,8 +823,8 @@ ex_tagf_alloc(SCR *sp, char *str)
for (p = t = str;; ++p) {
if (*p == '\0' || isblank(*p)) {
if ((len = p - t) > 1) {
- MALLOC_RET(sp, tfp, TAGF *, sizeof(TAGF));
- MALLOC(sp, tfp->name, char *, len + 1);
+ MALLOC_RET(sp, tfp, sizeof(TAGF));
+ MALLOC(sp, tfp->name, len + 1);
if (tfp->name == NULL) {
free(tfp);
return (1);
@@ -943,7 +943,7 @@ ctag_slist(SCR *sp, char *tag)
/* Allocate and initialize the tag queue structure. */
len = strlen(tag);
- CALLOC_GOTO(sp, tqp, TAGQ *, 1, sizeof(TAGQ) + len + 1);
+ CALLOC_GOTO(sp, tqp, 1, sizeof(TAGQ) + len + 1);
TAILQ_INIT(&tqp->tagq);
tqp->tag = tqp->buf;
memcpy(tqp->tag, tag, (tqp->tlen = len) + 1);
@@ -1089,7 +1089,7 @@ corrupt: p = msg_print(sp, tname, &nf1);
ctag_file(sp, tfp, name, &dname, &dlen);
CALLOC_GOTO(sp, tp,
- TAG *, 1, sizeof(TAG) + dlen + 2 + nlen + 1 + slen + 1);
+ 1, sizeof(TAG) + dlen + 2 + nlen + 1 + slen + 1);
tp->fname = tp->buf;
if (dlen != 0) {
memcpy(tp->fname, dname, dlen);
diff --git a/usr.bin/vi/vi/v_init.c b/usr.bin/vi/vi/v_init.c
index 6b30dbd5a46..a360a68ea88 100644
--- a/usr.bin/vi/vi/v_init.c
+++ b/usr.bin/vi/vi/v_init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: v_init.c,v 1.6 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: v_init.c,v 1.7 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -37,7 +37,7 @@ v_screen_copy(SCR *orig, SCR *sp)
VI_PRIVATE *ovip, *nvip;
/* Create the private vi structure. */
- CALLOC_RET(orig, nvip, VI_PRIVATE *, 1, sizeof(VI_PRIVATE));
+ CALLOC_RET(orig, nvip, 1, sizeof(VI_PRIVATE));
sp->vi_private = nvip;
/* Invalidate the line size cache. */
@@ -50,7 +50,7 @@ v_screen_copy(SCR *orig, SCR *sp)
/* User can replay the last input, but nothing else. */
if (ovip->rep_len != 0) {
- MALLOC_RET(orig, nvip->rep, EVENT *, ovip->rep_len);
+ MALLOC_RET(orig, nvip->rep, ovip->rep_len);
memmove(nvip->rep, ovip->rep, ovip->rep_len);
nvip->rep_len = ovip->rep_len;
}
diff --git a/usr.bin/vi/vi/v_paragraph.c b/usr.bin/vi/vi/v_paragraph.c
index 9ffe281220d..f2e7fd9b0b3 100644
--- a/usr.bin/vi/vi/v_paragraph.c
+++ b/usr.bin/vi/vi/v_paragraph.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: v_paragraph.c,v 1.7 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: v_paragraph.c,v 1.8 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -323,7 +323,7 @@ v_buildps(SCR *sp, char *p_p, char *s_p)
if (p_len == 0 && s_len == 0)
return (0);
- MALLOC_RET(sp, p, char *, p_len + s_len + 1);
+ MALLOC_RET(sp, p, p_len + s_len + 1);
vip = VIP(sp);
if (vip->ps != NULL)
diff --git a/usr.bin/vi/vi/vi.c b/usr.bin/vi/vi/vi.c
index 5cc10e57d3d..8d7f81ec750 100644
--- a/usr.bin/vi/vi/vi.c
+++ b/usr.bin/vi/vi/vi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vi.c,v 1.15 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: vi.c,v 1.16 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -962,7 +962,7 @@ v_init(SCR *sp)
sp->woff = 0;
/* Create a screen map. */
- CALLOC_RET(sp, HMAP, SMAP *, SIZE_HMAP(sp), sizeof(SMAP));
+ CALLOC_RET(sp, HMAP, SIZE_HMAP(sp), sizeof(SMAP));
TMAP = HMAP + (sp->t_rows - 1);
HMAP->lno = sp->lno;
HMAP->coff = 0;
diff --git a/usr.bin/vi/vi/vs_msg.c b/usr.bin/vi/vi/vs_msg.c
index 23ccf5eabc2..c528df14dba 100644
--- a/usr.bin/vi/vi/vs_msg.c
+++ b/usr.bin/vi/vi/vs_msg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vs_msg.c,v 1.14 2015/04/24 21:48:31 brynet Exp $ */
+/* $OpenBSD: vs_msg.c,v 1.15 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -884,8 +884,8 @@ vs_msgsave(SCR *sp, mtype_t mt, char *p, size_t len)
* allocate memory here, we're genuinely screwed, dump the message
* to stderr in the (probably) vain hope that someone will see it.
*/
- CALLOC_GOTO(sp, mp_n, MSGS *, 1, sizeof(MSGS));
- MALLOC_GOTO(sp, mp_n->buf, char *, len);
+ CALLOC_GOTO(sp, mp_n, 1, sizeof(MSGS));
+ MALLOC_GOTO(sp, mp_n->buf, len);
memmove(mp_n->buf, p, len);
mp_n->len = len;
diff --git a/usr.bin/vi/vi/vs_split.c b/usr.bin/vi/vi/vs_split.c
index 12b85061904..4f4660a232f 100644
--- a/usr.bin/vi/vi/vs_split.c
+++ b/usr.bin/vi/vi/vs_split.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vs_split.c,v 1.12 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: vs_split.c,v 1.13 2015/12/07 20:39:19 mmcc Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -59,7 +59,7 @@ vs_split(SCR *sp, SCR *new, int ccl)
half = 6;
/* Get a new screen map. */
- CALLOC(sp, _HMAP(new), SMAP *, SIZE_HMAP(sp), sizeof(SMAP));
+ CALLOC(sp, _HMAP(new), SIZE_HMAP(sp), sizeof(SMAP));
if (_HMAP(new) == NULL)
return (1);
_HMAP(new)->lno = sp->lno;
@@ -422,7 +422,7 @@ vs_swap(SCR *sp, SCR **nspp, char *name)
nsp->defscroll = nsp->t_maxrows / 2;
/* Allocate a new screen map. */
- CALLOC_RET(nsp, _HMAP(nsp), SMAP *, SIZE_HMAP(nsp), sizeof(SMAP));
+ CALLOC_RET(nsp, _HMAP(nsp), SIZE_HMAP(nsp), sizeof(SMAP));
_TMAP(nsp) = _HMAP(nsp) + (nsp->t_rows - 1);
/* Fill the map. */