| 134 | } php_emit_t; |
| 135 | |
| 136 | static bool php_is_url(const char *t, size_t n) { |
| 137 | size_t i = 0; |
| 138 | while (i < n && (isalnum((unsigned char)t[i]) || t[i] == '+' || t[i] == '.' || t[i] == '-')) { |
| 139 | i++; |
| 140 | } |
| 141 | if (i > 0 && i + CBM_SZ_3 <= n && memcmp(t + i, "://", CBM_SZ_3) == 0) { |
| 142 | return true; |
| 143 | } |
| 144 | return (n > CBM_SZ_4 && strncmp(t, "www.", CBM_SZ_4) == 0) || |
| 145 | (n > CBM_SZ_7 && strncmp(t, "mailto:", CBM_SZ_7) == 0); |
| 146 | } |
| 147 | |
| 148 | static void php_push(const php_emit_t *em, const char *ref, size_t n, uint32_t line) { |
| 149 | while (n > 0 && (ref[n - SKIP_ONE] == '.' || ref[n - SKIP_ONE] == ',' || |