| 230 | } |
| 231 | |
| 232 | char* |
| 233 | utfrune(const char *s, Rune c) |
| 234 | { |
| 235 | long c1; |
| 236 | Rune r; |
| 237 | int n; |
| 238 | |
| 239 | if(c < Runesync) /* not part of utf sequence */ |
| 240 | return strchr((char*)s, c); |
| 241 | |
| 242 | for(;;) { |
| 243 | c1 = *(unsigned char*)s; |
| 244 | if(c1 < Runeself) { /* one byte rune */ |
| 245 | if(c1 == 0) |
| 246 | return 0; |
| 247 | if(c1 == c) |
| 248 | return (char*)s; |
| 249 | s++; |
| 250 | continue; |
| 251 | } |
| 252 | n = chartorune(&r, s); |
| 253 | if(r == c) |
| 254 | return (char*)s; |
| 255 | s += n; |
| 256 | } |
| 257 | return 0; |
| 258 | } |
| 259 | |
| 260 | } // namespace re2 |