comparison: save correct link name
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 28 Jun 2013 11:53:46 +0000 (28 14:53 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 28 Jun 2013 11:53:46 +0000 (28 14:53 +0300)
This doesn't affect how the code works, but it's useful for debugging to
have an non-corrupted link name.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_comparison.c

index 09e9260..a6bfea9 100644 (file)
@@ -376,10 +376,12 @@ struct smatch_state *alloc_link_state(struct string_list *links)
 
        i = 0;
        FOR_EACH_PTR(links, tmp) {
-               if (!i++)
+               if (!i++) {
                        snprintf(buf, sizeof(buf), "%s", tmp);
-               else
-                       snprintf(buf, sizeof(buf), "%s, %s", buf, tmp);
+               } else {
+                       append(buf, ", ", sizeof(buf));
+                       append(buf, tmp, sizeof(buf));
+               }
        } END_FOR_EACH_PTR(tmp);
 
        state->name = alloc_sname(buf);