Fossil SCM
Optimized out an unnecessary string copy in appendDiffLine(), #undef'd a local macro in EncodeHttp().
Commit
a789e85ff63c432e18519081ccdfff3555129216
Parent
b5f2ebd3235d886…
2 files changed
+1
-4
+1
+1
-4
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -214,21 +214,18 @@ | ||
| 214 | 214 | int html, /* True if generating HTML. False for plain text */ |
| 215 | 215 | ReCompiled *pRe /* Colorize only if line matches this Regex */ |
| 216 | 216 | ){ |
| 217 | 217 | blob_append(pOut, &cPrefix, 1); |
| 218 | 218 | if( html ){ |
| 219 | - char *zHtml; | |
| 220 | 219 | if( pRe && re_dline_match(pRe, pLine, 1)==0 ){ |
| 221 | 220 | cPrefix = ' '; |
| 222 | 221 | }else if( cPrefix=='+' ){ |
| 223 | 222 | blob_append(pOut, "<span class=\"diffadd\">", -1); |
| 224 | 223 | }else if( cPrefix=='-' ){ |
| 225 | 224 | blob_append(pOut, "<span class=\"diffrm\">", -1); |
| 226 | 225 | } |
| 227 | - zHtml = htmlize(pLine->z, (pLine->h & LENGTH_MASK)); | |
| 228 | - blob_append(pOut, zHtml, -1); | |
| 229 | - fossil_free(zHtml); | |
| 226 | + htmlize_to_blob(pOut, pLine->z, (pLine->h & LENGTH_MASK)); | |
| 230 | 227 | if( cPrefix!=' ' ){ |
| 231 | 228 | blob_append(pOut, "</span>", -1); |
| 232 | 229 | } |
| 233 | 230 | }else{ |
| 234 | 231 | blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK); |
| 235 | 232 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -214,21 +214,18 @@ | |
| 214 | int html, /* True if generating HTML. False for plain text */ |
| 215 | ReCompiled *pRe /* Colorize only if line matches this Regex */ |
| 216 | ){ |
| 217 | blob_append(pOut, &cPrefix, 1); |
| 218 | if( html ){ |
| 219 | char *zHtml; |
| 220 | if( pRe && re_dline_match(pRe, pLine, 1)==0 ){ |
| 221 | cPrefix = ' '; |
| 222 | }else if( cPrefix=='+' ){ |
| 223 | blob_append(pOut, "<span class=\"diffadd\">", -1); |
| 224 | }else if( cPrefix=='-' ){ |
| 225 | blob_append(pOut, "<span class=\"diffrm\">", -1); |
| 226 | } |
| 227 | zHtml = htmlize(pLine->z, (pLine->h & LENGTH_MASK)); |
| 228 | blob_append(pOut, zHtml, -1); |
| 229 | fossil_free(zHtml); |
| 230 | if( cPrefix!=' ' ){ |
| 231 | blob_append(pOut, "</span>", -1); |
| 232 | } |
| 233 | }else{ |
| 234 | blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK); |
| 235 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -214,21 +214,18 @@ | |
| 214 | int html, /* True if generating HTML. False for plain text */ |
| 215 | ReCompiled *pRe /* Colorize only if line matches this Regex */ |
| 216 | ){ |
| 217 | blob_append(pOut, &cPrefix, 1); |
| 218 | if( html ){ |
| 219 | if( pRe && re_dline_match(pRe, pLine, 1)==0 ){ |
| 220 | cPrefix = ' '; |
| 221 | }else if( cPrefix=='+' ){ |
| 222 | blob_append(pOut, "<span class=\"diffadd\">", -1); |
| 223 | }else if( cPrefix=='-' ){ |
| 224 | blob_append(pOut, "<span class=\"diffrm\">", -1); |
| 225 | } |
| 226 | htmlize_to_blob(pOut, pLine->z, (pLine->h & LENGTH_MASK)); |
| 227 | if( cPrefix!=' ' ){ |
| 228 | blob_append(pOut, "</span>", -1); |
| 229 | } |
| 230 | }else{ |
| 231 | blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK); |
| 232 |
+1
| --- src/encode.c | ||
| +++ src/encode.c | ||
| @@ -161,10 +161,11 @@ | ||
| 161 | 161 | zOut[i++] = "0123456789ABCDEF"[c&0xf]; |
| 162 | 162 | } |
| 163 | 163 | zIn++; |
| 164 | 164 | } |
| 165 | 165 | zOut[i] = 0; |
| 166 | +#undef IsSafeChar | |
| 166 | 167 | return zOut; |
| 167 | 168 | } |
| 168 | 169 | |
| 169 | 170 | /* |
| 170 | 171 | ** Convert the input string into a form that is suitable for use as |
| 171 | 172 |
| --- src/encode.c | |
| +++ src/encode.c | |
| @@ -161,10 +161,11 @@ | |
| 161 | zOut[i++] = "0123456789ABCDEF"[c&0xf]; |
| 162 | } |
| 163 | zIn++; |
| 164 | } |
| 165 | zOut[i] = 0; |
| 166 | return zOut; |
| 167 | } |
| 168 | |
| 169 | /* |
| 170 | ** Convert the input string into a form that is suitable for use as |
| 171 |
| --- src/encode.c | |
| +++ src/encode.c | |
| @@ -161,10 +161,11 @@ | |
| 161 | zOut[i++] = "0123456789ABCDEF"[c&0xf]; |
| 162 | } |
| 163 | zIn++; |
| 164 | } |
| 165 | zOut[i] = 0; |
| 166 | #undef IsSafeChar |
| 167 | return zOut; |
| 168 | } |
| 169 | |
| 170 | /* |
| 171 | ** Convert the input string into a form that is suitable for use as |
| 172 |