save 1640 .text bytes in MKSH_SMALL case by not inlining strdupx, strndupx
This commit is contained in:
22
misc.c
22
misc.c
@@ -6,7 +6,7 @@
|
||||
#include <grp.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.88 2008/10/28 14:32:42 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.89 2008/10/28 14:51:06 tg Exp $");
|
||||
|
||||
#undef USE_CHVT
|
||||
#if defined(TIOCSCTTY) && !defined(MKSH_SMALL)
|
||||
@@ -1422,3 +1422,23 @@ stristr(const char *b, const char *l)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MKSH_SMALL
|
||||
char *
|
||||
strndup_(const char *src, size_t len, Area *ap)
|
||||
{
|
||||
char *dst = NULL;
|
||||
|
||||
if (src != NULL) {
|
||||
dst = alloc(++len, ap);
|
||||
strlcpy(dst, src, len);
|
||||
}
|
||||
return (dst);
|
||||
}
|
||||
|
||||
char *
|
||||
strdup_(const char *src, Area *ap)
|
||||
{
|
||||
return (src == NULL ? NULL : strndup_(src, strlen(src), ap));
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user