From 23f3f58d14a48836e3f685e14ae5aea78bd1b9f6 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 14 Aug 2010 21:35:13 +0000 Subject: [PATCH] on MirBSD we can use the system wcwidth() and save ~800by on the ramdisc --- expr.c | 4 +++- sh.h | 13 ++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/expr.c b/expr.c index 5dac772..6c5710c 100644 --- a/expr.c +++ b/expr.c @@ -22,7 +22,7 @@ #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[] */ enum token { @@ -798,6 +798,7 @@ utf_wctomb(char *dst, unsigned int wc) } +#ifndef MKSH_mirbsd_wcwidth /* --- begin of wcwidth.c excerpt --- */ /*- * Markus Kuhn -- 2007-05-26 (Unicode 5.0) @@ -891,3 +892,4 @@ utf_wcwidth(unsigned int c) (c >= 0xffe0 && c <= 0xffe6))) ? 2 : 1); } /* --- end of wcwidth.c excerpt --- */ +#endif diff --git a/sh.h b/sh.h index 640add0..70361f0 100644 --- a/sh.h +++ b/sh.h @@ -150,7 +150,7 @@ #endif #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 #define MKSH_VERSION "R39 2010/07/25" @@ -313,6 +313,15 @@ extern int __cdecl seteuid(uid_t); extern int __cdecl setegid(gid_t); #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 */ #ifdef EXTERN # define I__(i) = i @@ -1397,7 +1406,9 @@ int utf_widthadj(const char *, const char **); int utf_mbswidth(const char *); const char *utf_skipcols(const char *, int); size_t utf_ptradj(const char *); +#ifndef MKSH_mirbsd_wcwidth int utf_wcwidth(unsigned int); +#endif /* funcs.c */ int c_hash(const char **); int c_cd(const char **);