change use of “Area *” to “PArea” and “struct Area” to “TArea”

no change in size (mgcc and pcc, small and full)
This commit is contained in:
tg 2008-11-11 23:50:31 +00:00
parent 6a4afdde05
commit c80c28633b
7 changed files with 55 additions and 55 deletions

16
alloc.c
View File

@ -29,22 +29,24 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/alloc.c,v 1.8 2008/08/02 17:45:09 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/alloc.c,v 1.9 2008/11/11 23:50:28 tg Exp $");
struct link {
struct link *prev;
struct link *next;
};
Area *
ainit(Area *ap)
struct TArea aperm;
PArea
ainit(PArea ap)
{
ap->freelist = NULL;
return (ap);
}
void
afreeall(Area *ap)
afreeall(PArea ap)
{
struct link *l, *l2;
@ -59,7 +61,7 @@ afreeall(Area *ap)
#define P2L(p) ( (struct link *)(((ptrdiff_t)(p)) - sizeof (struct link)) )
void *
alloc(size_t size, Area *ap)
alloc(size_t size, PArea ap)
{
struct link *l;
@ -75,7 +77,7 @@ alloc(size_t size, Area *ap)
}
void *
aresize(void *ptr, size_t size, Area *ap)
aresize(void *ptr, size_t size, PArea ap)
{
struct link *l, *l2, *lprev, *lnext;
@ -99,7 +101,7 @@ aresize(void *ptr, size_t size, Area *ap)
}
void
afree(void *ptr, Area *ap)
afree(void *ptr, PArea ap)
{
struct link *l;
#ifdef MKSH_AFREE_DEBUG

8
edit.c
View File

@ -5,7 +5,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.141 2008/10/28 14:32:38 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.142 2008/11/11 23:50:28 tg Exp $");
/* tty driver characters we are interested in */
typedef struct {
@ -960,7 +960,7 @@ utf_wctomb(char *dst, unsigned int wc)
/* +++ emacs editing mode +++ */
static Area aedit;
static struct TArea aedit;
#define AEDIT &aedit /* area for kill ring and macro defns */
#define MKCTRL(x) ((x) == '?' ? 0x7F : (x) & 0x1F) /* ASCII */
@ -1072,7 +1072,7 @@ static int x_search(char *, int, int);
static int x_match(char *, char *);
static void x_redraw(int);
static void x_push(int);
static char *x_mapin(const char *, Area *);
static char *x_mapin(const char *, PArea);
static char *x_mapout(int);
static void x_mapout2(int, char **);
static void x_print(int, int);
@ -2518,7 +2518,7 @@ x_error(int c __unused)
}
static char *
x_mapin(const char *cp, Area *ap)
x_mapin(const char *cp, PArea ap)
{
char *new, *op;

6
lex.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.74 2008/10/28 14:32:41 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.75 2008/11/11 23:50:29 tg Exp $");
/*
* states while lexing word
@ -1031,7 +1031,7 @@ yyerror(const char *fmt, ...)
*/
Source *
pushs(int type, Area *areap)
pushs(int type, PArea areap)
{
Source *s;
@ -1261,7 +1261,7 @@ set_prompt(int to, Source *s)
{
struct shf *shf;
char * volatile ps1;
Area *saved_atemp;
PArea saved_atemp;
ps1 = str_val(global("PS1"));
shf = shf_sopen(NULL, strlen(ps1) * 2,

6
main.c
View File

@ -13,7 +13,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.106 2008/11/10 19:33:07 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.107 2008/11/11 23:50:30 tg Exp $");
extern char **environ;
@ -1136,7 +1136,7 @@ coproc_cleanup(int reuse)
}
struct temp *
maketemp(Area *ap, Temp_type type, struct temp **tlist)
maketemp(PArea ap, Temp_type type, struct temp **tlist)
{
struct temp *tp;
int len;
@ -1194,7 +1194,7 @@ hash(const char *n)
}
void
ktinit(struct table *tp, Area *ap, int tsize)
ktinit(struct table *tp, PArea ap, int tsize)
{
tp->areap = ap;
tp->tbls = NULL;

6
misc.c
View File

@ -6,7 +6,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.89 2008/10/28 14:51:06 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.90 2008/11/11 23:50:30 tg Exp $");
#undef USE_CHVT
#if defined(TIOCSCTTY) && !defined(MKSH_SMALL)
@ -1425,7 +1425,7 @@ stristr(const char *b, const char *l)
#ifdef MKSH_SMALL
char *
strndup_(const char *src, size_t len, Area *ap)
strndup_(const char *src, size_t len, PArea ap)
{
char *dst = NULL;
@ -1437,7 +1437,7 @@ strndup_(const char *src, size_t len, Area *ap)
}
char *
strdup_(const char *src, Area *ap)
strdup_(const char *src, PArea ap)
{
return (src == NULL ? NULL : strndup_(src, strlen(src), ap));
}

52
sh.h
View File

@ -103,7 +103,7 @@
#define __SCCSID(x) __IDSTRING(sccsid,x)
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.252 2008/11/10 19:33:08 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.253 2008/11/11 23:50:30 tg Exp $");
#endif
#define MKSH_VERSION "R36 2008/11/10"
@ -389,14 +389,12 @@ char *ucstrstr(char *, const char *);
#define MKSH_NOVI
#endif
/*
* Area-based allocation built on malloc/free
*/
typedef struct Area {
struct TArea {
struct link *freelist; /* free list */
} Area;
};
typedef struct TArea *PArea;
EXTERN Area aperm; /* permanent object space */
extern struct TArea aperm; /* permanent object space */
#define APERM &aperm
#define ATEMP &e->area
@ -404,7 +402,7 @@ EXTERN Area aperm; /* permanent object space */
* parsing & execution environment
*/
extern struct env {
Area area; /* temporary allocation area */
struct TArea area; /* temporary allocation area */
struct block *loc; /* local variables and functions */
short *savefd; /* original redirected fds */
struct env *oenv; /* link to previous environment */
@ -752,13 +750,13 @@ struct shf {
int fd; /* file descriptor */
int errno_; /* saved value of errno after error */
int bsize; /* actual size of buf */
Area *areap; /* area shf/buf were allocated in */
PArea areap; /* area shf/buf were allocated in */
};
extern struct shf shf_iob[];
struct table {
Area *areap; /* area to allocate entries */
PArea areap; /* area to allocate entries */
struct tbl **tbls; /* hashed table items */
short size, nfree; /* hash size (always 2^^n), free entries */
};
@ -767,7 +765,7 @@ struct tbl { /* table item */
Tflag flag; /* flags */
int type; /* command type (see below), base (if INTEGER),
* or offset from val.s of value (if EXPORT) */
Area *areap; /* area to allocate from */
PArea areap; /* area to allocate from */
union {
char *s; /* string */
long i; /* integer */
@ -859,7 +857,7 @@ struct arg_info {
* activation record for function blocks
*/
struct block {
Area area; /* area to allocate things */
struct TArea area; /* area to allocate things */
const char **argv;
int argc;
int flags; /* see BF_* */
@ -1063,7 +1061,7 @@ struct ioword {
typedef struct XString {
char *end, *beg; /* end, begin of string */
size_t len; /* length */
Area *areap; /* area to allocate/free from */
PArea areap; /* area to allocate/free from */
} XString;
typedef char *XStringP;
@ -1162,7 +1160,7 @@ struct source {
int errline; /* line the error occurred on (0 if not set) */
const char *file; /* input file name */
int flags; /* SF_* */
Area *areap;
PArea areap;
XString xs; /* input buffer */
Source *next; /* stacked source */
char ugbuf[2]; /* buffer for ungetsc() (SREREAD) and
@ -1255,11 +1253,11 @@ EXTERN int histsize; /* history size */
EXTERN struct timeval j_usrtime, j_systime;
/* alloc.c */
Area *ainit(Area *);
void afreeall(Area *);
void *alloc(size_t, Area *); /* cannot fail */
void *aresize(void *, size_t, Area *);
void afree(void *, Area *); /* can take NULL */
PArea ainit(PArea);
void afreeall(PArea);
void *alloc(size_t, PArea); /* cannot fail */
void *aresize(void *, size_t, PArea);
void afree(void *, PArea); /* can take NULL */
/* edit.c */
void x_init(void);
int x_read(char *, size_t);
@ -1390,7 +1388,7 @@ int yylex(int);
void yyerror(const char *, ...)
__attribute__((noreturn))
__attribute__((format (printf, 1, 2)));
Source *pushs(int, Area *);
Source *pushs(int, PArea);
void set_prompt(int, Source *);
void pprompt(const char *, int);
int promptlen(const char *);
@ -1437,9 +1435,9 @@ void coproc_readw_close(int);
void coproc_write_close(int);
int coproc_getfd(int, const char **);
void coproc_cleanup(int);
struct temp *maketemp(Area *, Temp_type, struct temp **);
struct temp *maketemp(PArea, Temp_type, struct temp **);
unsigned int hash(const char *);
void ktinit(struct table *, Area *, int);
void ktinit(struct table *, PArea, int);
struct tbl *ktsearch(struct table *, const char *, unsigned int);
struct tbl *ktenter(struct table *, const char *, unsigned int);
#define ktdelete(p) do { p->flag = 0; } while (0)
@ -1475,8 +1473,8 @@ void simplify_path(char *);
char *get_phys_path(const char *);
void set_current_wd(char *);
#ifdef MKSH_SMALL
char *strdup_(const char *, Area *);
char *strndup_(const char *, size_t, Area *);
char *strdup_(const char *, PArea);
char *strndup_(const char *, size_t, PArea);
#endif
/* shf.c */
struct shf *shf_open(const char *, int, int, int);
@ -1509,11 +1507,11 @@ struct op *compile(Source *);
/* tree.c */
int fptreef(struct shf *, int, const char *, ...);
char *snptreef(char *, int, const char *, ...);
struct op *tcopy(struct op *, Area *);
char *wdcopy(const char *, Area *);
struct op *tcopy(struct op *, PArea);
char *wdcopy(const char *, PArea);
const char *wdscan(const char *, int);
char *wdstrip(const char *, bool, bool);
void tfree(struct op *, Area *);
void tfree(struct op *, PArea);
/* var.c */
void newblock(void);
void popblock(void);

16
tree.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.21 2008/10/28 14:32:43 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.22 2008/11/11 23:50:31 tg Exp $");
#define INDENT 4
@ -12,8 +12,8 @@ static void pioact(struct shf *, int, struct ioword *);
static void tputC(int, struct shf *);
static void tputS(char *, struct shf *);
static void vfptreef(struct shf *, int, const char *, va_list);
static struct ioword **iocopy(struct ioword **, Area *);
static void iofree(struct ioword **, Area *);
static struct ioword **iocopy(struct ioword **, PArea);
static void iofree(struct ioword **, PArea);
/*
* print a command tree
@ -412,7 +412,7 @@ vfptreef(struct shf *shf, int indent, const char *fmt, va_list va)
* copy tree (for function definition)
*/
struct op *
tcopy(struct op *t, Area *ap)
tcopy(struct op *t, PArea ap)
{
struct op *r;
const char **tw;
@ -465,7 +465,7 @@ tcopy(struct op *t, Area *ap)
}
char *
wdcopy(const char *wp, Area *ap)
wdcopy(const char *wp, PArea ap)
{
size_t len = wdscan(wp, EOS) - wp;
return memcpy(alloc(len, ap), wp, len);
@ -611,7 +611,7 @@ wdstrip(const char *wp, bool keepq, bool make_magic)
}
static struct ioword **
iocopy(struct ioword **iow, Area *ap)
iocopy(struct ioword **iow, PArea ap)
{
struct ioword **ior;
int i;
@ -643,7 +643,7 @@ iocopy(struct ioword **iow, Area *ap)
* free tree (for function definition)
*/
void
tfree(struct op *t, Area *ap)
tfree(struct op *t, PArea ap)
{
char **w;
@ -678,7 +678,7 @@ tfree(struct op *t, Area *ap)
}
static void
iofree(struct ioword **iow, Area *ap)
iofree(struct ioword **iow, PArea ap)
{
struct ioword **iop;
struct ioword *p;