[patch] don't restart scanning from start in Html_parse_entities ()
Hi, below is a small optinization to Html_parse_entities (). Cheers, Johannes diff -r bd486ec2a522 src/html.cc --- a/src/html.cc Sat Mar 15 19:41:01 2008 +0100 +++ b/src/html.cc Sat Mar 15 20:23:03 2008 +0100 @@ -1397,13 +1397,14 @@ static char * { const char *esc_set = "&\xE2\xC2"; char *new_str, buf[4]; - int i, j, k, n, isocode, entsize; + int i, j, k, n, s, isocode, entsize; new_str = dStrndup(token, toksize); - if (new_str[strcspn(new_str, esc_set)] == 0) + s = strcspn(new_str, esc_set); + if (new_str[s] == 0) return new_str; - for (i = j = 0; i < toksize; i++) { + for (i = j = s; i < toksize; i++) { if (token[i] == '&' && (isocode = Html_parse_entity(html, token+i, toksize-i, &entsize)) >= 0) {
* Jorge Arellano Cid <jcid@dillo.org> [080317 19:40]:
On Sat, Mar 15, 2008 at 08:26:32PM +0100, Johannes Hofmann wrote:
Hi,
below is a small optinization to Html_parse_entities ().
Committed.
Unfortunately this misses the newly introduced inbuf_t for iconv compatibility. See my patch below: Kind Regards, Christian Index: src/html.cc =================================================================== RCS file: /sfhome/cvs/dillo/dillo2/src/html.cc,v retrieving revision 1.53 diff -b -u -r1.53 html.cc --- src/html.cc 17 Mar 2008 19:04:11 -0000 1.53 +++ src/html.cc 17 Mar 2008 20:19:21 -0000 @@ -3844,7 +3844,8 @@ int rc = 0; Dstr *output; const int bufsize = 128; - char *buffer, *inPtr, *outPtr; + inbuf_t *inPtr; + char *buffer, *outPtr; size_t inLeft, outRoom; bool bad_chars = false; -- You may use my gpg key for replies: pub 1024D/47F79788 2005/02/02 Christian Kellermann (C-Keen)
On Mon, Mar 17, 2008 at 09:09:04PM +0100, Christian Kellermann wrote:
* Jorge Arellano Cid <jcid@dillo.org> [080317 19:40]:
On Sat, Mar 15, 2008 at 08:26:32PM +0100, Johannes Hofmann wrote:
Hi,
below is a small optinization to Html_parse_entities ().
Committed.
Unfortunately this misses the newly introduced inbuf_t for iconv compatibility. See my patch below:
Kind Regards,
Ooops, committed. -- Cheers Jorge.-
participants (3)
-
Christian.Kellermann@nefkom.net
-
jcid@dillo.org
-
Johannes.Hofmann@gmx.de