using a function instead of a macro saves 896 bytes of .text

This commit is contained in:
tg 2006-11-09 20:53:42 +00:00
parent 617950554f
commit 35776a9d4d
2 changed files with 9 additions and 3 deletions

8
misc.c
View File

@ -3,7 +3,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.19 2006/11/09 14:19:31 tg Exp $\t"
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.20 2006/11/09 20:53:41 tg Exp $\t"
MKSH_SH_H_ID);
short chtypes[UCHAR_MAX+1]; /* type bits for unsigned char */
@ -81,6 +81,12 @@ str_nsave(const char *s, int n, Area *ap)
return (ns);
}
char *
str_save(const char *s, Area *ap)
{
return (str_nsave(s, s ? strlen(s) : 0, ap));
}
/* called from XcheckN() to grow buffer */
char *
Xcheck_grow_(XString *xsp, char *xp, unsigned more)

4
sh.h
View File

@ -8,7 +8,7 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.59 2006/11/09 15:03:56 tg Exp $"
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.60 2006/11/09 20:53:42 tg Exp $"
#define MKSH_VERSION "R29 2006/11/09"
#if HAVE_SYS_PARAM_H
@ -1217,7 +1217,7 @@ struct tbl **ktsort(struct table *);
void setctypes(const char *, int);
void initctypes(void);
char *ulton(unsigned long, int);
#define str_save(s, a) str_nsave((s), (s) ? strlen(s) : 0, a)
char *str_save(const char *, Area *);
char *str_nsave(const char *, int, Area *);
int option(const char *);
char *getoptions(void);