@@ -122,7 +122,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
122
122
if (* (e + 1 ) == '\0' ) { /* only scheme is available */
123
123
ret -> scheme = estrndup (s , (e - s ));
124
124
php_replace_controlchars_ex (ret -> scheme , (e - s ));
125
- goto end ;
125
+ return ret ;
126
126
}
127
127
128
128
/*
@@ -145,8 +145,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
145
145
ret -> scheme = estrndup (s , (e - s ));
146
146
php_replace_controlchars_ex (ret -> scheme , (e - s ));
147
147
148
- length -= ++ e - s ;
149
- s = e ;
148
+ s = e + 1 ;
150
149
goto just_path ;
151
150
} else {
152
151
ret -> scheme = estrndup (s , (e - s ));
@@ -162,18 +161,12 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
162
161
if (* (e + 5 ) == ':' ) {
163
162
s = e + 4 ;
164
163
}
165
- goto nohost ;
164
+ goto just_path ;
166
165
}
167
166
}
168
167
} else {
169
- if (!strncasecmp ("file" , ret -> scheme , sizeof ("file" ))) {
170
- s = e + 1 ;
171
- goto nohost ;
172
- } else {
173
- length -= ++ e - s ;
174
- s = e ;
175
- goto just_path ;
176
- }
168
+ s = e + 1 ;
169
+ goto just_path ;
177
170
}
178
171
}
179
172
} else if (e ) { /* no scheme; starts with colon: look for port */
@@ -212,9 +205,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
212
205
} else if (* s == '/' && * (s + 1 ) == '/' ) { /* relative-scheme URL */
213
206
s += 2 ;
214
207
} else {
215
- just_path :
216
- ue = s + length ;
217
- goto nohost ;
208
+ goto just_path ;
218
209
}
219
210
220
211
e = s + strcspn (s , "/?#" );
@@ -296,7 +287,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
296
287
297
288
s = e ;
298
289
299
- nohost :
290
+ just_path :
300
291
301
292
if ((p = memchr (s , '?' , (ue - s )))) {
302
293
pp = memchr (s , '#' , (ue - s ));
@@ -343,7 +334,6 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
343
334
ret -> path = estrndup (s , (ue - s ));
344
335
php_replace_controlchars_ex (ret -> path , (ue - s ));
345
336
}
346
- end :
347
337
return ret ;
348
338
}
349
339
/* }}} */
0 commit comments