Fossil SCM

Zeroed a pointer in its declaration to squish a warning from GCC 4.8.4 on Ubuntu 14.04 about use of a potentially uninitted pointer. I don't think it's actually possible for the current code to use the pointer in the window between its declaration and first use, but I think we can afford the extra machine instruction this will cost us. (I assume newer GCCs are smart enough to analyze this situation correctly, which is why the warning hasn't been squished earlier.)

wyoung 2018-08-11 19:28 trunk
Commit 892781cb23c0335fea36b45a28bb2436b3910d032c8a53427fa3d1942bd58a3f
1 file changed +1 -1
+1 -1
--- src/forum.c
+++ src/forum.c
@@ -154,11 +154,11 @@
154154
** completes, entries that have non-NULL pLeaf should not be
155155
** displayed.
156156
*/
157157
for(pEntry=pThread->pFirst; pEntry; pEntry=pEntry->pNext){
158158
if( pEntry->fprev ){
159
- ForumEntry *pBase, *p;
159
+ ForumEntry *pBase = 0, *p;
160160
p = forumentry_backward(pEntry->pPrev, pEntry->fprev);
161161
pEntry->pEdit = p;
162162
while( p ){
163163
pBase = p;
164164
p->pLeaf = pEntry;
165165
--- src/forum.c
+++ src/forum.c
@@ -154,11 +154,11 @@
154 ** completes, entries that have non-NULL pLeaf should not be
155 ** displayed.
156 */
157 for(pEntry=pThread->pFirst; pEntry; pEntry=pEntry->pNext){
158 if( pEntry->fprev ){
159 ForumEntry *pBase, *p;
160 p = forumentry_backward(pEntry->pPrev, pEntry->fprev);
161 pEntry->pEdit = p;
162 while( p ){
163 pBase = p;
164 p->pLeaf = pEntry;
165
--- src/forum.c
+++ src/forum.c
@@ -154,11 +154,11 @@
154 ** completes, entries that have non-NULL pLeaf should not be
155 ** displayed.
156 */
157 for(pEntry=pThread->pFirst; pEntry; pEntry=pEntry->pNext){
158 if( pEntry->fprev ){
159 ForumEntry *pBase = 0, *p;
160 p = forumentry_backward(pEntry->pPrev, pEntry->fprev);
161 pEntry->pEdit = p;
162 while( p ){
163 pBase = p;
164 p->pLeaf = pEntry;
165

Keyboard Shortcuts

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