diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-10-13 15:51:27 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-10-13 15:51:27 +0000 |
commit | 8fcc1628b61893fa9719c1f8ae8a032494b98946 (patch) | |
tree | 36f70ab2bb1b4a31dabceab437c8b6cb357a20f9 | |
parent | b97ccbccda36682d7b0ed61cfb8e923f9dfc7be3 (diff) | |
download | pcre-8fcc1628b61893fa9719c1f8ae8a032494b98946.tar.gz |
Rewrite code that broke under Mac OS (isxdigit with ++ in its argument).
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@735 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | pcretest.c | 8 |
2 files changed, 14 insertions, 1 deletions
@@ -107,6 +107,13 @@ Version 8.20 10-Oct-2011 20. Fixed an ASCII-dependent infelicity in pcretest that would have made it fail to work when decoding hex characters in data strings in EBCDIC environments. + +21. It appears that in at least one Mac OS environment, the isxdigit() function + is implemented as a macro that evaluates to its argument more than once, + contravening the C 90 Standard (I haven't checked a later standard). There + was an instance in pcretest which caused it to go wrong when processing + \x{...} escapes in subject strings. The has been rewritten to avoid using + things like p++ in the argument of isxdigit(). Version 8.13 16-Aug-2011 @@ -2346,7 +2346,13 @@ while (!done) { unsigned char *pt = p; c = 0; - while (isxdigit(*(++pt))) + + /* We used to have "while (isxdigit(*(++pt)))" here, but it fails + when isxdigit() is a macro that refers to its argument more than + once. This is banned by the C Standard, but apparently happens in at + least one MacOS environment. */ + + for (pt++; isxdigit(*pt); pt++) c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'a' - 10); if (*pt == '}') { |