Avoid warning in parse_declaration_list.
authorRobin Watts <[email protected]>
Tue, 22 Sep 2020 16:34:31 +0000 (17:34 +0100)
committerRobin Watts <[email protected]>
Wed, 23 Sep 2020 17:38:12 +0000 (18:38 +0100)
By initing variables differently, we can avoid the "tail might be
used unitialised" warning.

source/html/css-parse.c

index 076f68a944f4bcf80cc78d411c1ec3e71f032d6f..5fa1a98d4045ccb56f63fddeb6720089185454a9 100644 (file)
@@ -602,7 +602,7 @@ static fz_css_property *parse_declaration(struct lexbuf *buf)
 
 static fz_css_property *parse_declaration_list(struct lexbuf *buf)
 {
-       fz_css_property *head = NULL, *tail, *p;
+       fz_css_property *head, *tail = NULL, *p;
 
        white(buf);
 
@@ -611,7 +611,8 @@ static fz_css_property *parse_declaration_list(struct lexbuf *buf)
 
        p = parse_declaration(buf);
        if (p)
-               head = tail = p;
+               tail = p;
+       head = tail;
 
        while (accept(buf, ';'))
        {