changeset 149:3f37b40ceab9

- Minor optimization to Html_parse_entities().
author jcid
date Mon, 17 Mar 2008 19:49:27 +0100
parents 029012f3f10c
children b31af65cfe6a
files src/html.cc
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/html.cc	Sun Mar 16 15:01:15 2008 +0100
+++ b/src/html.cc	Mon Mar 17 19:49:27 2008 +0100
@@ -1397,13 +1397,14 @@
 {
    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) {