Index: iso2022.c =================================================================== RCS file: /cvs/gnome/vte/src/iso2022.c,v retrieving revision 1.50 diff -u -r1.50 iso2022.c --- iso2022.c 15 Sep 2003 18:57:33 -0000 1.50 +++ iso2022.c 27 May 2004 13:39:23 -0000 @@ -862,35 +862,31 @@ } static char * -_vte_iso2022_better(char *p, char *q) -{ - if (p == NULL) { - return q; - } - if (q == NULL) { - return p; - } - return MIN(p, q); -} - -static char * _vte_iso2022_find_nextctl(const char *p, size_t length) { char *ret; + int i; + if (length == 0) { return NULL; } - ret = memchr(p, '\033', length); - ret = _vte_iso2022_better(ret, memchr(p, '\n', length)); - ret = _vte_iso2022_better(ret, memchr(p, '\r', length)); - ret = _vte_iso2022_better(ret, memchr(p, '\016', length)); - ret = _vte_iso2022_better(ret, memchr(p, '\017', length)); + + for (i = 0; i < length; ++i) { + if (p[i] == '\033' || + p[i] == '\n' || + p[i] == '\r' || + p[i] == '\016' || + p[i] == '\017' #ifdef VTE_ISO2022_8_BIT_CONTROLS - /* This breaks UTF-8 and other encodings which use the high bits. */ - ret = _vte_iso2022_better(ret, memchr(p, 0x8e, length)); - ret = _vte_iso2022_better(ret, memchr(p, 0x8f, length)); + || + p[i] == 0x8e || + p[i] == 0x8f #endif - return ret; + ) { + return (char *)p + i; + } + } + return NULL; } static long