summaryrefslogtreecommitdiff
path: root/bin/ksh
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-02-19 18:51:18 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-02-19 18:51:18 +0000
commitda68571d35c20bf003d82af49885656d780632b0 (patch)
tree0429ba3ee86079a6288eb2e0ceedd0ce71845ba4 /bin/ksh
parent3f5da1a40b89c85980651213c743cbe3169e65d2 (diff)
basic knf
Diffstat (limited to 'bin/ksh')
-rw-r--r--bin/ksh/alloc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bin/ksh/alloc.c b/bin/ksh/alloc.c
index 09df76b0779..8aaf4ff0726 100644
--- a/bin/ksh/alloc.c
+++ b/bin/ksh/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.6 2003/08/05 20:52:27 millert Exp $ */
+/* $OpenBSD: alloc.c,v 1.7 2004/02/19 18:51:17 deraadt Exp $ */
/*
* Copyright (c) 2002 Marc Espie.
*
@@ -62,7 +62,7 @@ alloc(size_t size, Area *ap)
{
struct link *l;
- l = malloc(size + sizeof(struct link));
+ l = malloc(sizeof(struct link) + size);
if (l == NULL)
internal_errorf(1, "unable to allocate memory");
l->next = ap->freelist;
@@ -86,15 +86,15 @@ aresize(void *ptr, size_t size, Area *ap)
lprev = l->prev;
lnext = l->next;
- l2 = realloc(l, size+sizeof(struct link));
+ l2 = realloc(l, sizeof(struct link) + size);
if (l2 == NULL)
internal_errorf(1, "unable to allocate memory");
if (lprev)
- lprev->next = l2;
+ lprev->next = l2;
else
- ap->freelist = l2;
+ ap->freelist = l2;
if (lnext)
- lnext->prev = l2;
+ lnext->prev = l2;
return L2P(l2);
}