FS-9457: fix code after decl error

This commit is contained in:
Mike Jerris 2016-09-07 12:44:44 -04:00
parent 7bee958a51
commit d7c77ba96d

View File

@ -68,6 +68,8 @@ void parse_url(char *url, const char *base_domain, const char *default_base_doma
char *bucket_start = NULL; char *bucket_start = NULL;
char *bucket_end; char *bucket_end;
char *object_start; char *object_start;
char *p;
char base_domain_match[1024];
*bucket = NULL; *bucket = NULL;
*object = NULL; *object = NULL;
@ -82,40 +84,37 @@ void parse_url(char *url, const char *base_domain, const char *default_base_doma
} else if (!strncasecmp(url, "http://", 7)) { } else if (!strncasecmp(url, "http://", 7)) {
bucket_start = url + 7; bucket_start = url + 7;
} }
if (zstr(bucket_start)) {
/* invalid URL */ if (zstr(bucket_start)) { /* invalid URL */
return; return;
} }
{
char base_domain_match[1024];
if (zstr(base_domain)) { if (zstr(base_domain)) {
base_domain = default_base_domain; base_domain = default_base_domain;
} }
switch_snprintf(base_domain_match, 1024, ".%s", base_domain); switch_snprintf(base_domain_match, 1024, ".%s", base_domain);
bucket_end = my_strrstr(bucket_start, base_domain_match); bucket_end = my_strrstr(bucket_start, base_domain_match);
}
if (!bucket_end) { if (!bucket_end) { /* invalid URL */
/* invalid URL */
return; return;
} }
*bucket_end = '\0'; *bucket_end = '\0';
object_start = strchr(bucket_end + 1, '/'); object_start = strchr(bucket_end + 1, '/');
if (!object_start) {
/* invalid URL */ if (!object_start) { /* invalid URL */
return; return;
} }
object_start++; object_start++;
if (zstr(bucket_start) || zstr(object_start)) { if (zstr(bucket_start) || zstr(object_start)) { /* invalid URL */
/* invalid URL */
return; return;
} }
// ignore the query string from the end of the URL /* ignore the query string from the end of the URL */
char *p = strchr(object_start, '&'); if ((p = strchr(object_start, '&'))) {
if (p) {
*p = '\0'; *p = '\0';
} }
@ -124,7 +123,6 @@ void parse_url(char *url, const char *base_domain, const char *default_base_doma
} }
/* For Emacs: /* For Emacs:
* Local Variables: * Local Variables:
* mode:c * mode:c