Fossil SCM

Another attempt to fix non-constant format complaint.

wyoung 2018-11-09 19:16 login-on-post
Commit 725630f3f854e3e224836ce4178e6208af3fad33feb9a0b2461b94b647aefc4d
1 file changed +8 -6
+8 -6
--- src/forum.c
+++ src/forum.c
@@ -971,16 +971,18 @@
971971
if( !g.perm.RdForum ){
972972
login_needed(g.anon.RdForum);
973973
return;
974974
}
975975
style_header("Forum");
976
- {
977
- /* 2-step split required by some GCCs, which think this first
978
- * expression "has non-constant format". Whatever GCC...
979
- */
980
- const char* target = g.perm.WrForum ? "%R/forumnew" : "%R/login";
981
- style_submenu_element("New Thread", target);
976
+ if( g.perm.WrForum ){
977
+ style_submenu_element("New Thread","%R/forumnew");
978
+ }else{
979
+ /* Can't combine this with previous case using the ternary operator
980
+ * because that causes an error yelling about "non-constant format"
981
+ * with some compilers. I can't see it, since both expressions have
982
+ * the same format, but I'm no C spec lawyer. */
983
+ style_submenu_element("New Thread","%R/login");
982984
}
983985
if( g.perm.ModForum && moderation_needed() ){
984986
style_submenu_element("Moderation Requests", "%R/modreq");
985987
}
986988
if( (srchFlags & SRCH_FORUM)!=0 ){
987989
--- src/forum.c
+++ src/forum.c
@@ -971,16 +971,18 @@
971 if( !g.perm.RdForum ){
972 login_needed(g.anon.RdForum);
973 return;
974 }
975 style_header("Forum");
976 {
977 /* 2-step split required by some GCCs, which think this first
978 * expression "has non-constant format". Whatever GCC...
979 */
980 const char* target = g.perm.WrForum ? "%R/forumnew" : "%R/login";
981 style_submenu_element("New Thread", target);
 
 
982 }
983 if( g.perm.ModForum && moderation_needed() ){
984 style_submenu_element("Moderation Requests", "%R/modreq");
985 }
986 if( (srchFlags & SRCH_FORUM)!=0 ){
987
--- src/forum.c
+++ src/forum.c
@@ -971,16 +971,18 @@
971 if( !g.perm.RdForum ){
972 login_needed(g.anon.RdForum);
973 return;
974 }
975 style_header("Forum");
976 if( g.perm.WrForum ){
977 style_submenu_element("New Thread","%R/forumnew");
978 }else{
979 /* Can't combine this with previous case using the ternary operator
980 * because that causes an error yelling about "non-constant format"
981 * with some compilers. I can't see it, since both expressions have
982 * the same format, but I'm no C spec lawyer. */
983 style_submenu_element("New Thread","%R/login");
984 }
985 if( g.perm.ModForum && moderation_needed() ){
986 style_submenu_element("Moderation Requests", "%R/modreq");
987 }
988 if( (srchFlags & SRCH_FORUM)!=0 ){
989

Keyboard Shortcuts

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