summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-04-16 18:14:55 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-04-16 18:14:55 (GMT)
commit2b4c279e0ba71a2727bb76740ba90ea2f800fc90 (patch)
tree44e21620cd63b22ab7b5a532411356a0fcff481e /generic/tclInt.h
parent54bf1628429213cb630d7e08afc0ffc7f2e55772 (diff)
downloadtcl-2b4c279e0ba71a2727bb76740ba90ea2f800fc90.zip
tcl-2b4c279e0ba71a2727bb76740ba90ea2f800fc90.tar.gz
tcl-2b4c279e0ba71a2727bb76740ba90ea2f800fc90.tar.bz2
Create and use macro TclUtfPrev for Tcl_UtfPrev.
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r--generic/tclInt.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 15bc000..3dc3d1d 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -3691,6 +3691,11 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, CONST char *file,
((*(chPtr) = (unsigned char) *(str)), 1) \
: Tcl_UtfToUniChar(str, chPtr))
+#define TclUtfPrev(src, start) \
+ (((src) < (start)+2) ? (start) : \
+ ((unsigned char) *(src - 1)) < 0x80 ? (src)-1 : \
+ Tcl_UtfPrev(src, start))
+
/*
*----------------------------------------------------------------
* Macro that encapsulates the logic that determines when it is safe to