These changes pacify gcc -Wanalyzer-null-dereference on x86-64 gcc
11.2.1
20210728 (Red Hat 11.2.1-1).
* lib/wordsplit.c (wsnode_tail): Remove unnecessary test.
(coalesce_segment): Coalesce calls to wsnode_len.
static struct wordsplit_node *
wsnode_tail (struct wordsplit_node *p)
{
- while (p && p->next)
+ while (p->next)
p = p->next;
return p;
}
char *buf, *cur;
int stop;
- if (!(node->flags & _WSNF_JOIN))
- return 0;
-
- for (p = node; p && (p->flags & _WSNF_JOIN); p = p->next)
+ for (p = node; p->flags & _WSNF_JOIN; )
{
len += wsnode_len (p);
+ p = p->next;
+ if (!p)
+ break;
}
- if (p)
- len += wsnode_len (p);
+ if (p == node)
+ return 0;
end = p;
buf = malloc (len + 1);