Fossil SCM

Optimized out an unnecessary string copy in appendDiffLine(), #undef'd a local macro in EncodeHttp().

stephan 2013-08-31 14:03 trunk
Commit a789e85ff63c432e18519081ccdfff3555129216
2 files changed +1 -4 +1
+1 -4
--- src/diff.c
+++ src/diff.c
@@ -214,21 +214,18 @@
214214
int html, /* True if generating HTML. False for plain text */
215215
ReCompiled *pRe /* Colorize only if line matches this Regex */
216216
){
217217
blob_append(pOut, &cPrefix, 1);
218218
if( html ){
219
- char *zHtml;
220219
if( pRe && re_dline_match(pRe, pLine, 1)==0 ){
221220
cPrefix = ' ';
222221
}else if( cPrefix=='+' ){
223222
blob_append(pOut, "<span class=\"diffadd\">", -1);
224223
}else if( cPrefix=='-' ){
225224
blob_append(pOut, "<span class=\"diffrm\">", -1);
226225
}
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));
230227
if( cPrefix!=' ' ){
231228
blob_append(pOut, "</span>", -1);
232229
}
233230
}else{
234231
blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK);
235232
--- 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
--- src/encode.c
+++ src/encode.c
@@ -161,10 +161,11 @@
161161
zOut[i++] = "0123456789ABCDEF"[c&0xf];
162162
}
163163
zIn++;
164164
}
165165
zOut[i] = 0;
166
+#undef IsSafeChar
166167
return zOut;
167168
}
168169
169170
/*
170171
** Convert the input string into a form that is suitable for use as
171172
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button