Fossil SCM
Another attempt to fix non-constant format complaint.
Commit
725630f3f854e3e224836ce4178e6208af3fad33feb9a0b2461b94b647aefc4d
Parent
095333fc603f655…
1 file changed
+8
-6
+8
-6
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -971,16 +971,18 @@ | ||
| 971 | 971 | if( !g.perm.RdForum ){ |
| 972 | 972 | login_needed(g.anon.RdForum); |
| 973 | 973 | return; |
| 974 | 974 | } |
| 975 | 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); | |
| 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"); | |
| 982 | 984 | } |
| 983 | 985 | if( g.perm.ModForum && moderation_needed() ){ |
| 984 | 986 | style_submenu_element("Moderation Requests", "%R/modreq"); |
| 985 | 987 | } |
| 986 | 988 | if( (srchFlags & SRCH_FORUM)!=0 ){ |
| 987 | 989 |
| --- 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 |