summaryrefslogtreecommitdiffstats
path: root/gl/mbsinit.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/mbsinit.c')
-rw-r--r--gl/mbsinit.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gl/mbsinit.c b/gl/mbsinit.c
index 066ddfe5..26fbb7fa 100644
--- a/gl/mbsinit.c
+++ b/gl/mbsinit.c
@@ -1,5 +1,5 @@
1/* Test for initial conversion state. 1/* Test for initial conversion state.
2 Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. 2 Copyright (C) 2008-2013 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2008. 3 Written by Bruno Haible <bruno@clisp.org>, 2008.
4 4
5 This program is free software: you can redistribute it and/or modify 5 This program is free software: you can redistribute it and/or modify
@@ -22,6 +22,18 @@
22 22
23#include "verify.h" 23#include "verify.h"
24 24
25#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
26
27/* On native Windows, 'mbstate_t' is defined as 'int'. */
28
29int
30mbsinit (const mbstate_t *ps)
31{
32 return ps == NULL || *ps == 0;
33}
34
35#else
36
25/* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs() 37/* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs()
26 and wcrtomb(), wcsrtombs(). 38 and wcrtomb(), wcsrtombs().
27 We assume that 39 We assume that
@@ -43,5 +55,7 @@ mbsinit (const mbstate_t *ps)
43{ 55{
44 const char *pstate = (const char *)ps; 56 const char *pstate = (const char *)ps;
45 57
46 return pstate[0] == 0; 58 return pstate == NULL || pstate[0] == 0;
47} 59}
60
61#endif