diff options
Diffstat (limited to 'include/shmbutil.h')
-rw-r--r-- | include/shmbutil.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/shmbutil.h b/include/shmbutil.h index a737780..1139d50 100644 --- a/include/shmbutil.h +++ b/include/shmbutil.h @@ -31,6 +31,8 @@ extern size_t xmbsrtowcs __P((wchar_t *, const char **, size_t, mbstate_t *)); extern size_t xdupmbstowcs __P((wchar_t **, char ***, const char *)); +extern size_t mbstrlen __P((const char *)); + extern char *xstrchr __P((const char *, int)); #ifndef MB_INVALIDCH @@ -38,6 +40,9 @@ extern char *xstrchr __P((const char *, int)); #define MB_NULLWCH(x) ((x) == 0) #endif +#define MBSLEN(s) (((s) && (s)[0]) ? ((s)[1] ? mbstrlen (s) : 1) : 0) +#define MB_STRLEN(s) ((MB_CUR_MAX > 1) ? MBSLEN (s) : STRLEN (s)) + #else /* !HANDLE_MULTIBYTE */ #undef MB_LEN_MAX @@ -54,6 +59,8 @@ extern char *xstrchr __P((const char *, int)); #define MB_NULLWCH(x) (0) #endif +#define MB_STRLEN(s) (STRLEN(s)) + #endif /* !HANDLE_MULTIBYTE */ /* Declare and initialize a multibyte state. Call must be terminated |