switch to a (nmemb,size) API from a (nmemb*size) API

cost: text += (308, 256, 4, -100)
This commit is contained in:
tg
2008-11-12 00:54:52 +00:00
parent 246b762af7
commit 4d3fc2413e
16 changed files with 136 additions and 140 deletions

10
eval.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.49 2008/10/28 14:32:39 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.50 2008/11/12 00:54:47 tg Exp $");
#ifdef MKSH_SMALL
#define MKSH_NOPWNAM
@ -297,7 +297,7 @@ expand(const char *cp, /* input word */
if (!st->next) {
SubType *newst;
newst = (SubType *)alloc(
newst = alloc(1,
sizeof (SubType), ATEMP);
newst->next = NULL;
newst->prev = st;
@ -590,7 +590,7 @@ expand(const char *cp, /* input word */
*/
len = strlen(dp) + 1;
setstr(st->var,
debunk((char *)alloc(len, ATEMP),
debunk(alloc(1, len, ATEMP),
dp, len), KSH_UNWIND_ERROR);
x.str = str_val(st->var);
type = XSUB;
@ -770,7 +770,7 @@ expand(const char *cp, /* input word */
Xlength(ds, dp) == 0) {
char *p;
*(p = alloc(1, ATEMP)) = '\0';
*(p = alloc(1, 1, ATEMP)) = '\0';
XPput(*wp, p);
}
type = XSUBMID;
@ -1474,7 +1474,7 @@ alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo)
l1 = brace_start - start;
l2 = (p - 1) - field_start;
l3 = end - brace_end;
new = (char *)alloc(l1 + l2 + l3 + 1, ATEMP);
new = alloc(1, l1 + l2 + l3 + 1, ATEMP);
memcpy(new, start, l1);
memcpy(new + l1, field_start, l2);
memcpy(new + l1 + l2, brace_end, l3);