Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
b6efea26
Commit
b6efea26
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
chars: invalid sequences are not blank, nor text, nor punctuation
So, slightly speed up the functions that check for those.
parent
8686cb3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/chars.c
+3
-7
src/chars.c
with
3 additions
and
7 deletions
+3
-7
src/chars.c
View file @
b6efea26
...
...
@@ -35,10 +35,6 @@
static
bool
use_utf8
=
FALSE
;
/* Whether we've enabled UTF-8 support. */
static
const
wchar_t
bad_wchar
=
0xFFFD
;
/* If we get an invalid multibyte sequence, we treat it as
* Unicode FFFD (Replacement Character), unless we're searching
* for a match to it. */
static
const
char
*
const
bad_mbchar
=
"
\xEF\xBF\xBD
"
;
static
const
int
bad_mbchar_len
=
3
;
...
...
@@ -110,7 +106,7 @@ bool is_alnum_mbchar(const char *c)
if
(
mbtowc
(
&
wc
,
c
,
MB_CUR_MAX
)
<
0
)
{
mbtowc_reset
();
wc
=
bad_wchar
;
return
0
;
}
return
iswalnum
(
wc
);
...
...
@@ -130,7 +126,7 @@ bool is_blank_mbchar(const char *c)
if
(
mbtowc
(
&
wc
,
c
,
MB_CUR_MAX
)
<
0
)
{
mbtowc_reset
();
wc
=
bad_wchar
;
return
0
;
}
return
iswblank
(
wc
);
...
...
@@ -180,7 +176,7 @@ bool is_punct_mbchar(const char *c)
if
(
mbtowc
(
&
wc
,
c
,
MB_CUR_MAX
)
<
0
)
{
mbtowc_reset
();
wc
=
bad_wchar
;
return
0
;
}
return
iswpunct
(
wc
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help