Branch: Tag:

2011-02-27

2011-02-27 21:26:37 by Martin Nilsson <nilsson@opera.com>

Optimized fragment parsing.

211:    return;    }    -  if(has_prefix (uri, "#") && this_program::base_uri) +  // Parse fragment identifier +  // fragment = *( pchar / "/" / "?" ) +  // pchar = unreserved / pct-encoded / sub-delims / ":" / "@" +  if( sscanf(uri, "%s#%s", uri, fragment)==2 )    { -  +  DEBUG("Found fragment %O", fragment); +  if( !sizeof(uri) ) +  {    DEBUG("Fragment only. Using entire base URI, except fragment."); -  +  string f = fragment;    inherit_properties(this_program::base_uri); -  fragment = uri[1..]; +  fragment = f;    return;    } -  +  }    -  // Parse fragment identifier -  // fragment = *( pchar / "/" / "?" ) -  // pchar = unreserved / pct-encoded / sub-delims / ":" / "@" -  sscanf(uri, "%s#%s", uri, fragment); -  DEBUG("Found fragment %O", fragment); -  +     // Parse scheme    // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )    if(sscanf(uri, "%[A-Za-z0-9+.-]:%s", scheme, uri) < 2)