Move URL parser enum into parser function

This commit is contained in:
Kovid Goyal 2018-12-04 06:59:03 +05:30
parent 47ec372c30
commit e0b3bb1830
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -50,13 +50,13 @@ cell_text(CPUCell *cell) {
static const char* url_prefixes[4] = {"https", "http", "file", "ftp"};
static size_t url_prefix_lengths[sizeof(url_prefixes)/sizeof(url_prefixes[0])] = {0};
typedef enum URL_PARSER_STATES {ANY, FIRST_SLASH, SECOND_SLASH} URL_PARSER_STATE;
static inline index_type
find_colon_slash(Line *self, index_type x, index_type limit) {
// Find :// at or before x
index_type pos = x;
URL_PARSER_STATE state = ANY;
enum URL_PARSER_STATES {ANY, FIRST_SLASH, SECOND_SLASH};
enum URL_PARSER_STATES state = ANY;
limit = MAX(2, limit);
if (pos < limit) return 0;
do {