Fossil SCM

Remove [forum:/forumpost/2f375863dbc6|useless] 'nMaxDigit' parameter from the signature of the <tt>style_submenu_parametric()</tt>. Also edit a corresponding comment.

george 2021-04-09 04:21 rptview-submenu-paralink
Commit d1651e7e1711660e0648e10cead234772f7ee1a9032b598c45e0cdc2b1862395
3 files changed +2 -2 +15 -13 +1 -1
+2 -2
--- src/report.c
+++ src/report.c
@@ -1044,12 +1044,12 @@
10441044
style_submenu_element("Reports","%R/reportlist?%s",zQS);
10451045
} else {
10461046
style_submenu_element("Raw","%R/%s?tablist=1",g.zPath);
10471047
style_submenu_element("Reports","%R/reportlist");
10481048
}
1049
- style_submenu_parametric("rptview_",5);
1050
- style_submenu_parametric("rv",5);
1049
+ style_submenu_parametric("rptview_");
1050
+ style_submenu_parametric("rv");
10511051
10521052
if( g.perm.Admin
10531053
|| (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
10541054
style_submenu_element("Edit", "rptedit?rn=%d", rn);
10551055
}
10561056
--- src/report.c
+++ src/report.c
@@ -1044,12 +1044,12 @@
1044 style_submenu_element("Reports","%R/reportlist?%s",zQS);
1045 } else {
1046 style_submenu_element("Raw","%R/%s?tablist=1",g.zPath);
1047 style_submenu_element("Reports","%R/reportlist");
1048 }
1049 style_submenu_parametric("rptview_",5);
1050 style_submenu_parametric("rv",5);
1051
1052 if( g.perm.Admin
1053 || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
1054 style_submenu_element("Edit", "rptedit?rn=%d", rn);
1055 }
1056
--- src/report.c
+++ src/report.c
@@ -1044,12 +1044,12 @@
1044 style_submenu_element("Reports","%R/reportlist?%s",zQS);
1045 } else {
1046 style_submenu_element("Raw","%R/%s?tablist=1",g.zPath);
1047 style_submenu_element("Reports","%R/reportlist");
1048 }
1049 style_submenu_parametric("rptview_");
1050 style_submenu_parametric("rv");
1051
1052 if( g.perm.Admin
1053 || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
1054 style_submenu_element("Edit", "rptedit?rn=%d", rn);
1055 }
1056
+15 -13
--- src/style.c
+++ src/style.c
@@ -331,24 +331,26 @@
331331
nSubmenuCtrl++;
332332
}
333333
}
334334
335335
/* Add hyperlinks depending on the existence and values of special
336
-** parameters in the request's query string. The names of these
337
-** parameters that are investigated are obtainted by concatenation
338
-** of zPrefix with suffix "smplX", where X is either nothing or
339
-** a positive digit <= nMaxDigit. zPrefix must start with a lowercase
340
-** letter, be short and have no strange characters. A value is
341
-** well-formed if its first filepath segment (separated by '/')
342
-** has no strange characters. The labels of the resulting submenu items
343
-** are equal to the well-formed values that are prepended by "✧"
344
-** unless a value starts with a lowercase letter.
345
-** Malformed values are silently ignored.
336
+** parameters in the request's query string. The names of a query's
337
+** parameters that are investigated are obtainted by concatenation of
338
+** the caller-provided zPrefix with suffix "smplX", where X is either
339
+** nothing or a positive digit. zPrefix must start with a lowercase
340
+** letter, be short and have no strange characters. Parameter's value
341
+** is well-formed if its first filepath segment (separated by '/')
342
+** has no strange characters. Malformed values are silently ignored.
343
+**
344
+** The text for the resulting submenu item equals to the value of the
345
+** parameter modulus some prettification for better UX:
346
+** "✧" symbol is prepended unless parameter's value starts with a
347
+** lowercase letter or contains '/', also underscores in the first
348
+** path segment are replaced with spaces.
346349
*/
347350
void style_submenu_parametric(
348
- const char *zPrefix, /* common prefix of the query parameters names */
349
- const int nMaxDigit /* maximal digit on the end of param names */
351
+ const char *zPrefix /* common prefix of the query parameters names */
350352
){
351353
static const char *suffix = "smpl"; /* common suffix for param names */
352354
static const short sfxlen = 4; /* length of the above suffix */
353355
const char *zQS; /* QUERY_STRING */
354356
char zN[32]; /* buffer for parameter names to probe */
@@ -363,11 +365,11 @@
363365
strcpy( zN, zPrefix );
364366
strcpy( zN + l, suffix );
365367
l += sfxlen;
366368
zN[l+1] = 0; /* nul-terminator after digit's placeholder (if any) */
367369
zQS = PD("QUERY_STRING","");
368
- for( i = 0; i <= 9 && i <= nMaxDigit; i++ ){
370
+ for( i = 0; i <= 9; i++ ){
369371
const char *zV, *z;
370372
zN[l] = ( i == 0 ? 0 : '0' + i ); /* ...smpl instead of ...smpl0 */
371373
zV = PD(zN,"");
372374
if( zV[0] == 0 || zV[0] == '/' ){
373375
continue;
374376
--- src/style.c
+++ src/style.c
@@ -331,24 +331,26 @@
331 nSubmenuCtrl++;
332 }
333 }
334
335 /* Add hyperlinks depending on the existence and values of special
336 ** parameters in the request's query string. The names of these
337 ** parameters that are investigated are obtainted by concatenation
338 ** of zPrefix with suffix "smplX", where X is either nothing or
339 ** a positive digit <= nMaxDigit. zPrefix must start with a lowercase
340 ** letter, be short and have no strange characters. A value is
341 ** well-formed if its first filepath segment (separated by '/')
342 ** has no strange characters. The labels of the resulting submenu items
343 ** are equal to the well-formed values that are prepended by "✧"
344 ** unless a value starts with a lowercase letter.
345 ** Malformed values are silently ignored.
 
 
 
346 */
347 void style_submenu_parametric(
348 const char *zPrefix, /* common prefix of the query parameters names */
349 const int nMaxDigit /* maximal digit on the end of param names */
350 ){
351 static const char *suffix = "smpl"; /* common suffix for param names */
352 static const short sfxlen = 4; /* length of the above suffix */
353 const char *zQS; /* QUERY_STRING */
354 char zN[32]; /* buffer for parameter names to probe */
@@ -363,11 +365,11 @@
363 strcpy( zN, zPrefix );
364 strcpy( zN + l, suffix );
365 l += sfxlen;
366 zN[l+1] = 0; /* nul-terminator after digit's placeholder (if any) */
367 zQS = PD("QUERY_STRING","");
368 for( i = 0; i <= 9 && i <= nMaxDigit; i++ ){
369 const char *zV, *z;
370 zN[l] = ( i == 0 ? 0 : '0' + i ); /* ...smpl instead of ...smpl0 */
371 zV = PD(zN,"");
372 if( zV[0] == 0 || zV[0] == '/' ){
373 continue;
374
--- src/style.c
+++ src/style.c
@@ -331,24 +331,26 @@
331 nSubmenuCtrl++;
332 }
333 }
334
335 /* Add hyperlinks depending on the existence and values of special
336 ** parameters in the request's query string. The names of a query's
337 ** parameters that are investigated are obtainted by concatenation of
338 ** the caller-provided zPrefix with suffix "smplX", where X is either
339 ** nothing or a positive digit. zPrefix must start with a lowercase
340 ** letter, be short and have no strange characters. Parameter's value
341 ** is well-formed if its first filepath segment (separated by '/')
342 ** has no strange characters. Malformed values are silently ignored.
343 **
344 ** The text for the resulting submenu item equals to the value of the
345 ** parameter modulus some prettification for better UX:
346 ** "✧" symbol is prepended unless parameter's value starts with a
347 ** lowercase letter or contains '/', also underscores in the first
348 ** path segment are replaced with spaces.
349 */
350 void style_submenu_parametric(
351 const char *zPrefix /* common prefix of the query parameters names */
 
352 ){
353 static const char *suffix = "smpl"; /* common suffix for param names */
354 static const short sfxlen = 4; /* length of the above suffix */
355 const char *zQS; /* QUERY_STRING */
356 char zN[32]; /* buffer for parameter names to probe */
@@ -363,11 +365,11 @@
365 strcpy( zN, zPrefix );
366 strcpy( zN + l, suffix );
367 l += sfxlen;
368 zN[l+1] = 0; /* nul-terminator after digit's placeholder (if any) */
369 zQS = PD("QUERY_STRING","");
370 for( i = 0; i <= 9; i++ ){
371 const char *zV, *z;
372 zN[l] = ( i == 0 ? 0 : '0' + i ); /* ...smpl instead of ...smpl0 */
373 zV = PD(zN,"");
374 if( zV[0] == 0 || zV[0] == '/' ){
375 continue;
376
+1 -1
--- src/wiki.c
+++ src/wiki.c
@@ -593,11 +593,11 @@
593593
}else if( rid && g.perm.ApndWiki ){
594594
style_submenu_element("Edit", "%R/wikiappend?name=%T", zPageName);
595595
}
596596
if( g.perm.Hyperlink ){
597597
style_submenu_element("History", "%R/whistory?name=%T", zPageName);
598
- style_submenu_parametric("wiki",7);
598
+ style_submenu_parametric("wiki");
599599
}
600600
}
601601
if( !isPopup ){
602602
style_set_current_page("%T?name=%T", g.zPath, zPageName);
603603
wiki_page_header(WIKITYPE_UNKNOWN, zPageName, "");
604604
--- src/wiki.c
+++ src/wiki.c
@@ -593,11 +593,11 @@
593 }else if( rid && g.perm.ApndWiki ){
594 style_submenu_element("Edit", "%R/wikiappend?name=%T", zPageName);
595 }
596 if( g.perm.Hyperlink ){
597 style_submenu_element("History", "%R/whistory?name=%T", zPageName);
598 style_submenu_parametric("wiki",7);
599 }
600 }
601 if( !isPopup ){
602 style_set_current_page("%T?name=%T", g.zPath, zPageName);
603 wiki_page_header(WIKITYPE_UNKNOWN, zPageName, "");
604
--- src/wiki.c
+++ src/wiki.c
@@ -593,11 +593,11 @@
593 }else if( rid && g.perm.ApndWiki ){
594 style_submenu_element("Edit", "%R/wikiappend?name=%T", zPageName);
595 }
596 if( g.perm.Hyperlink ){
597 style_submenu_element("History", "%R/whistory?name=%T", zPageName);
598 style_submenu_parametric("wiki");
599 }
600 }
601 if( !isPopup ){
602 style_set_current_page("%T?name=%T", g.zPath, zPageName);
603 wiki_page_header(WIKITYPE_UNKNOWN, zPageName, "");
604

Keyboard Shortcuts

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