Fossil SCM

Minor efficiency hack in style_emit_script_builtin() and swapped a potentially problematic ordering of two JS includes.

stephan 2020-05-10 09:16 fileedit-ajaxify
Commit c60ad868b41266c39dd5599458ae5828236c0e455b32814beebb04c566d1feec
2 files changed +1 -1 +6 -5
+1 -1
--- src/fileedit.c
+++ src/fileedit.c
@@ -1867,12 +1867,12 @@
18671867
blob_reset(&err);
18681868
CheckinMiniInfo_cleanup(&cimi);
18691869
style_emit_script_fossil_bootstrap(0);
18701870
style_emit_script_fetch(0);
18711871
style_emit_script_tabs(0);
1872
- style_emit_script_builtin(0, "fossil.page.fileedit.js");
18731872
style_emit_script_confirmer(0);
1873
+ style_emit_script_builtin(0, "fossil.page.fileedit.js");
18741874
if(blob_size(&endScript)>0){
18751875
style_emit_script_tag(0,0);
18761876
CX("(function(){\n");
18771877
CX("try{\n%b\n}"
18781878
"catch(e){"
18791879
--- src/fileedit.c
+++ src/fileedit.c
@@ -1867,12 +1867,12 @@
1867 blob_reset(&err);
1868 CheckinMiniInfo_cleanup(&cimi);
1869 style_emit_script_fossil_bootstrap(0);
1870 style_emit_script_fetch(0);
1871 style_emit_script_tabs(0);
1872 style_emit_script_builtin(0, "fossil.page.fileedit.js");
1873 style_emit_script_confirmer(0);
 
1874 if(blob_size(&endScript)>0){
1875 style_emit_script_tag(0,0);
1876 CX("(function(){\n");
1877 CX("try{\n%b\n}"
1878 "catch(e){"
1879
--- src/fileedit.c
+++ src/fileedit.c
@@ -1867,12 +1867,12 @@
1867 blob_reset(&err);
1868 CheckinMiniInfo_cleanup(&cimi);
1869 style_emit_script_fossil_bootstrap(0);
1870 style_emit_script_fetch(0);
1871 style_emit_script_tabs(0);
 
1872 style_emit_script_confirmer(0);
1873 style_emit_script_builtin(0, "fossil.page.fileedit.js");
1874 if(blob_size(&endScript)>0){
1875 style_emit_script_tag(0,0);
1876 CX("(function(){\n");
1877 CX("try{\n%b\n}"
1878 "catch(e){"
1879
+6 -5
--- src/style.c
+++ src/style.c
@@ -1586,21 +1586,22 @@
15861586
if(asInline){
15871587
style_emit_script_tag(0,0);
15881588
CX("%s", builtin_text(zName));
15891589
style_emit_script_tag(1,0);
15901590
}else{
1591
- char * zFull = mprintf("builtin/%s",zName);
1592
- const char * zBuiltin = builtin_text(zName);
1591
+ char * zFullName = mprintf("builtin/%s",zName);
1592
+ int nLen = 0;
1593
+ const char * zBuiltin = (const char *)builtin_file(zName, &nLen);
15931594
const char * zHash = 0;
15941595
if(zBuiltin!=0){
15951596
md5sum_init();
1596
- md5sum_step_text(zBuiltin,-1);
1597
+ md5sum_step_text(zBuiltin,nLen);
15971598
zHash = md5sum_finish(0);
15981599
}
1599
- CX("<script src='%R/%T?cache=%.8s'></script>\n",zFull,
1600
+ CX("<script src='%R/%T?cache=%.8s'></script>\n",zFullName,
16001601
zHash ? zHash : "MISSING");
1601
- fossil_free(zFull);
1602
+ fossil_free(zFullName);
16021603
}
16031604
}
16041605
16051606
/*
16061607
** The first time this is called it emits the JS code from the
16071608
--- src/style.c
+++ src/style.c
@@ -1586,21 +1586,22 @@
1586 if(asInline){
1587 style_emit_script_tag(0,0);
1588 CX("%s", builtin_text(zName));
1589 style_emit_script_tag(1,0);
1590 }else{
1591 char * zFull = mprintf("builtin/%s",zName);
1592 const char * zBuiltin = builtin_text(zName);
 
1593 const char * zHash = 0;
1594 if(zBuiltin!=0){
1595 md5sum_init();
1596 md5sum_step_text(zBuiltin,-1);
1597 zHash = md5sum_finish(0);
1598 }
1599 CX("<script src='%R/%T?cache=%.8s'></script>\n",zFull,
1600 zHash ? zHash : "MISSING");
1601 fossil_free(zFull);
1602 }
1603 }
1604
1605 /*
1606 ** The first time this is called it emits the JS code from the
1607
--- src/style.c
+++ src/style.c
@@ -1586,21 +1586,22 @@
1586 if(asInline){
1587 style_emit_script_tag(0,0);
1588 CX("%s", builtin_text(zName));
1589 style_emit_script_tag(1,0);
1590 }else{
1591 char * zFullName = mprintf("builtin/%s",zName);
1592 int nLen = 0;
1593 const char * zBuiltin = (const char *)builtin_file(zName, &nLen);
1594 const char * zHash = 0;
1595 if(zBuiltin!=0){
1596 md5sum_init();
1597 md5sum_step_text(zBuiltin,nLen);
1598 zHash = md5sum_finish(0);
1599 }
1600 CX("<script src='%R/%T?cache=%.8s'></script>\n",zFullName,
1601 zHash ? zHash : "MISSING");
1602 fossil_free(zFullName);
1603 }
1604 }
1605
1606 /*
1607 ** The first time this is called it emits the JS code from the
1608

Keyboard Shortcuts

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