on MirBSD we can use the system wcwidth() and save ~800by on the ramdisc

This commit is contained in:
tg 2010-08-14 21:35:13 +00:00
parent b5bdc6d10f
commit 23f3f58d14
2 changed files with 15 additions and 2 deletions

4
expr.c
View File

@ -22,7 +22,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.43 2010/01/25 14:38:00 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/expr.c,v 1.44 2010/08/14 21:35:13 tg Exp $");
/* The order of these enums is constrained by the order of opinfo[] */ /* The order of these enums is constrained by the order of opinfo[] */
enum token { enum token {
@ -798,6 +798,7 @@ utf_wctomb(char *dst, unsigned int wc)
} }
#ifndef MKSH_mirbsd_wcwidth
/* --- begin of wcwidth.c excerpt --- */ /* --- begin of wcwidth.c excerpt --- */
/*- /*-
* Markus Kuhn -- 2007-05-26 (Unicode 5.0) * Markus Kuhn -- 2007-05-26 (Unicode 5.0)
@ -891,3 +892,4 @@ utf_wcwidth(unsigned int c)
(c >= 0xffe0 && c <= 0xffe6))) ? 2 : 1); (c >= 0xffe0 && c <= 0xffe6))) ? 2 : 1);
} }
/* --- end of wcwidth.c excerpt --- */ /* --- end of wcwidth.c excerpt --- */
#endif

13
sh.h
View File

@ -150,7 +150,7 @@
#endif #endif
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.402 2010/07/25 11:35:42 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.403 2010/08/14 21:35:13 tg Exp $");
#endif #endif
#define MKSH_VERSION "R39 2010/07/25" #define MKSH_VERSION "R39 2010/07/25"
@ -313,6 +313,15 @@ extern int __cdecl seteuid(uid_t);
extern int __cdecl setegid(gid_t); extern int __cdecl setegid(gid_t);
#endif #endif
/* remove redundances */
#if defined(MirBSD) && (MirBSD >= 0x08A8)
#define MKSH_mirbsd_wcwidth
#define utf_wcwidth(i) wcwidth((__WCHAR_TYPE__)i)
extern int wcwidth(__WCHAR_TYPE__);
#endif
/* some useful #defines */ /* some useful #defines */
#ifdef EXTERN #ifdef EXTERN
# define I__(i) = i # define I__(i) = i
@ -1397,7 +1406,9 @@ int utf_widthadj(const char *, const char **);
int utf_mbswidth(const char *); int utf_mbswidth(const char *);
const char *utf_skipcols(const char *, int); const char *utf_skipcols(const char *, int);
size_t utf_ptradj(const char *); size_t utf_ptradj(const char *);
#ifndef MKSH_mirbsd_wcwidth
int utf_wcwidth(unsigned int); int utf_wcwidth(unsigned int);
#endif
/* funcs.c */ /* funcs.c */
int c_hash(const char **); int c_hash(const char **);
int c_cd(const char **); int c_cd(const char **);