summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorXavier G <xavier.github@kindwolf.org>2016-05-13 02:27:19 +0200
committerXavier G <xavier.github@kindwolf.org>2016-05-13 02:27:19 +0200
commit21c07c006066115af4604e26cd89cf60f94a7d53 (patch)
treefdd7ae546475c026a7c9738d8d074b0134db6eea /src/core
parent2c8648a9c889fc0a7c4b24367a3f81f08dedccb2 (diff)
downloadirssi-21c07c006066115af4604e26cd89cf60f94a7d53.zip
Leverage string_policy().
Diffstat (limited to 'src/core')
-rw-r--r--src/core/utf8.c5
-rw-r--r--src/core/utf8.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/core/utf8.c b/src/core/utf8.c
index d931ba19..c9303d19 100644
--- a/src/core/utf8.c
+++ b/src/core/utf8.c
@@ -28,9 +28,9 @@
/* Provide is_utf8(): */
#include "recode.h"
-int string_advance(char const **str, gboolean utf8)
+int string_advance(char const **str, int policy)
{
- if (utf8) {
+ if (policy == TREAT_STRING_AS_UTF8) {
gunichar c;
c = g_utf8_get_char(*str);
@@ -38,6 +38,7 @@ int string_advance(char const **str, gboolean utf8)
return unichar_isprint(c) ? mk_wcwidth(c) : 1;
} else {
+ /* Assume TREAT_STRING_AS_BYTES: */
*str += 1;
return 1;
diff --git a/src/core/utf8.h b/src/core/utf8.h
index fa11b737..f1a8f0e1 100644
--- a/src/core/utf8.h
+++ b/src/core/utf8.h
@@ -17,7 +17,7 @@ int mk_wcwidth(unichar c);
/* Advance the str pointer one character further; return the number of columns
* occupied by the skipped character.
*/
-int string_advance(char const **str, gboolean utf8);
+int string_advance(char const **str, int policy);
/* TREAT_STRING_AS_BYTES means strings are to be treated using strncpy,
* strnlen, etc.