Fossil SCM

Some minor performance improvements on timeline.

drh 2010-03-18 13:47 trunk
Commit edea06eec729abc37f60bae5ea9d9de9b2d24bbf
+1 -1
--- src/attach.c
+++ src/attach.c
@@ -137,11 +137,11 @@
137137
*/
138138
void attachview_page(void){
139139
const char *zPage = P("page");
140140
const char *zTkt = P("tkt");
141141
const char *zFile = P("file");
142
- const char *zTarget;
142
+ const char *zTarget = 0;
143143
int attachid = atoi(PD("attachid","0"));
144144
char *zUUID;
145145
146146
if( zPage && zTkt ) zTkt = 0;
147147
if( zFile==0 ) fossil_redirect_home();
148148
--- src/attach.c
+++ src/attach.c
@@ -137,11 +137,11 @@
137 */
138 void attachview_page(void){
139 const char *zPage = P("page");
140 const char *zTkt = P("tkt");
141 const char *zFile = P("file");
142 const char *zTarget;
143 int attachid = atoi(PD("attachid","0"));
144 char *zUUID;
145
146 if( zPage && zTkt ) zTkt = 0;
147 if( zFile==0 ) fossil_redirect_home();
148
--- src/attach.c
+++ src/attach.c
@@ -137,11 +137,11 @@
137 */
138 void attachview_page(void){
139 const char *zPage = P("page");
140 const char *zTkt = P("tkt");
141 const char *zFile = P("file");
142 const char *zTarget = 0;
143 int attachid = atoi(PD("attachid","0"));
144 char *zUUID;
145
146 if( zPage && zTkt ) zTkt = 0;
147 if( zFile==0 ) fossil_redirect_home();
148
--- src/timeline.c
+++ src/timeline.c
@@ -200,14 +200,10 @@
200200
if( tmFlags & TIMELINE_GRAPH ){
201201
pGraph = graph_init();
202202
@ <div id="canvas" style="position:relative;width:1px;height:1px;"></div>
203203
}
204204
205
- db_multi_exec(
206
- "CREATE TEMP TABLE IF NOT EXISTS seen(rid INTEGER PRIMARY KEY);"
207
- "DELETE FROM seen;"
208
- );
209205
@ <table cellspacing=0 border=0 cellpadding=0>
210206
blob_zero(&comment);
211207
while( db_step(pQuery)==SQLITE_ROW ){
212208
int rid = db_column_int(pQuery, 0);
213209
const char *zUuid = db_column_text(pQuery, 1);
@@ -241,11 +237,10 @@
241237
}
242238
if( strcmp(zType,"div")==0 ){
243239
@ <tr><td colspan=3><hr></td></tr>
244240
continue;
245241
}
246
- db_multi_exec("INSERT OR IGNORE INTO seen VALUES(%d)", rid);
247242
if( memcmp(zDate, zPrevDate, 10) ){
248243
sprintf(zPrevDate, "%.10s", zDate);
249244
@ <tr><td>
250245
@ <div class="divider"><nobr>%s(zPrevDate)</nobr></div>
251246
@ </td></tr>
252247
--- src/timeline.c
+++ src/timeline.c
@@ -200,14 +200,10 @@
200 if( tmFlags & TIMELINE_GRAPH ){
201 pGraph = graph_init();
202 @ <div id="canvas" style="position:relative;width:1px;height:1px;"></div>
203 }
204
205 db_multi_exec(
206 "CREATE TEMP TABLE IF NOT EXISTS seen(rid INTEGER PRIMARY KEY);"
207 "DELETE FROM seen;"
208 );
209 @ <table cellspacing=0 border=0 cellpadding=0>
210 blob_zero(&comment);
211 while( db_step(pQuery)==SQLITE_ROW ){
212 int rid = db_column_int(pQuery, 0);
213 const char *zUuid = db_column_text(pQuery, 1);
@@ -241,11 +237,10 @@
241 }
242 if( strcmp(zType,"div")==0 ){
243 @ <tr><td colspan=3><hr></td></tr>
244 continue;
245 }
246 db_multi_exec("INSERT OR IGNORE INTO seen VALUES(%d)", rid);
247 if( memcmp(zDate, zPrevDate, 10) ){
248 sprintf(zPrevDate, "%.10s", zDate);
249 @ <tr><td>
250 @ <div class="divider"><nobr>%s(zPrevDate)</nobr></div>
251 @ </td></tr>
252
--- src/timeline.c
+++ src/timeline.c
@@ -200,14 +200,10 @@
200 if( tmFlags & TIMELINE_GRAPH ){
201 pGraph = graph_init();
202 @ <div id="canvas" style="position:relative;width:1px;height:1px;"></div>
203 }
204
 
 
 
 
205 @ <table cellspacing=0 border=0 cellpadding=0>
206 blob_zero(&comment);
207 while( db_step(pQuery)==SQLITE_ROW ){
208 int rid = db_column_int(pQuery, 0);
209 const char *zUuid = db_column_text(pQuery, 1);
@@ -241,11 +237,10 @@
237 }
238 if( strcmp(zType,"div")==0 ){
239 @ <tr><td colspan=3><hr></td></tr>
240 continue;
241 }
 
242 if( memcmp(zDate, zPrevDate, 10) ){
243 sprintf(zPrevDate, "%.10s", zDate);
244 @ <tr><td>
245 @ <div class="divider"><nobr>%s(zPrevDate)</nobr></div>
246 @ </td></tr>
247
+15 -2
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -369,10 +369,23 @@
369369
short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */
370370
const char *zId; /* ID attribute or NULL */
371371
} *aStack;
372372
};
373373
374
+/*
375
+** Return TRUE if HTML should be used as the sole markup language for wiki.
376
+**
377
+** On first invocation, this routine consults the "wiki-use-html" setting.
378
+** It caches the result for subsequent invocations, under the assumption
379
+** that the setting will not change.
380
+*/
381
+static int wikiUsesHtml(void){
382
+ static int r = -1;
383
+ if( r<0 ) r = db_get_boolean("wiki-use-html", 0);
384
+ return r;
385
+}
386
+
374387
375388
/*
376389
** z points to a "<" character. Check to see if this is the start of
377390
** a valid markup. If it is, return the total number of characters in
378391
** the markup including the initial "<" and the terminating ">". If
@@ -1390,11 +1403,11 @@
13901403
if( flags & WIKI_INLINE ){
13911404
renderer.wantAutoParagraph = 0;
13921405
}else{
13931406
renderer.wantAutoParagraph = 1;
13941407
}
1395
- if( db_get_int("wiki-use-html", 0) ){
1408
+ if( wikiUsesHtml() ){
13961409
renderer.state |= WIKI_USE_HTML;
13971410
}
13981411
if( pOut ){
13991412
renderer.pOut = pOut;
14001413
}else{
@@ -1477,11 +1490,11 @@
14771490
memset(&renderer, 0, sizeof(renderer));
14781491
renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
14791492
if( flags & WIKI_NOBLOCK ){
14801493
renderer.state |= INLINE_MARKUP_ONLY;
14811494
}
1482
- if( db_get_int("wiki-use-html", 0) ){
1495
+ if( wikiUsesHtml() ){
14831496
renderer.state |= WIKI_USE_HTML;
14841497
wikiUseHtml = 1;
14851498
}
14861499
inlineOnly = (renderer.state & INLINE_MARKUP_ONLY)!=0;
14871500
if( replaceFlag ){
14881501
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -369,10 +369,23 @@
369 short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */
370 const char *zId; /* ID attribute or NULL */
371 } *aStack;
372 };
373
 
 
 
 
 
 
 
 
 
 
 
 
 
374
375 /*
376 ** z points to a "<" character. Check to see if this is the start of
377 ** a valid markup. If it is, return the total number of characters in
378 ** the markup including the initial "<" and the terminating ">". If
@@ -1390,11 +1403,11 @@
1390 if( flags & WIKI_INLINE ){
1391 renderer.wantAutoParagraph = 0;
1392 }else{
1393 renderer.wantAutoParagraph = 1;
1394 }
1395 if( db_get_int("wiki-use-html", 0) ){
1396 renderer.state |= WIKI_USE_HTML;
1397 }
1398 if( pOut ){
1399 renderer.pOut = pOut;
1400 }else{
@@ -1477,11 +1490,11 @@
1477 memset(&renderer, 0, sizeof(renderer));
1478 renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
1479 if( flags & WIKI_NOBLOCK ){
1480 renderer.state |= INLINE_MARKUP_ONLY;
1481 }
1482 if( db_get_int("wiki-use-html", 0) ){
1483 renderer.state |= WIKI_USE_HTML;
1484 wikiUseHtml = 1;
1485 }
1486 inlineOnly = (renderer.state & INLINE_MARKUP_ONLY)!=0;
1487 if( replaceFlag ){
1488
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -369,10 +369,23 @@
369 short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */
370 const char *zId; /* ID attribute or NULL */
371 } *aStack;
372 };
373
374 /*
375 ** Return TRUE if HTML should be used as the sole markup language for wiki.
376 **
377 ** On first invocation, this routine consults the "wiki-use-html" setting.
378 ** It caches the result for subsequent invocations, under the assumption
379 ** that the setting will not change.
380 */
381 static int wikiUsesHtml(void){
382 static int r = -1;
383 if( r<0 ) r = db_get_boolean("wiki-use-html", 0);
384 return r;
385 }
386
387
388 /*
389 ** z points to a "<" character. Check to see if this is the start of
390 ** a valid markup. If it is, return the total number of characters in
391 ** the markup including the initial "<" and the terminating ">". If
@@ -1390,11 +1403,11 @@
1403 if( flags & WIKI_INLINE ){
1404 renderer.wantAutoParagraph = 0;
1405 }else{
1406 renderer.wantAutoParagraph = 1;
1407 }
1408 if( wikiUsesHtml() ){
1409 renderer.state |= WIKI_USE_HTML;
1410 }
1411 if( pOut ){
1412 renderer.pOut = pOut;
1413 }else{
@@ -1477,11 +1490,11 @@
1490 memset(&renderer, 0, sizeof(renderer));
1491 renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
1492 if( flags & WIKI_NOBLOCK ){
1493 renderer.state |= INLINE_MARKUP_ONLY;
1494 }
1495 if( wikiUsesHtml() ){
1496 renderer.state |= WIKI_USE_HTML;
1497 wikiUseHtml = 1;
1498 }
1499 inlineOnly = (renderer.state & INLINE_MARKUP_ONLY)!=0;
1500 if( replaceFlag ){
1501

Keyboard Shortcuts

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