name-rev: fix off-by-one error in --stdin.
[gitweb.git] / name-rev.c
index 59194f1349ff4df860dd9ee4a3f183e17b72b6fc..7d89401a41e911ff770b1ef63b56ef1a11619934 100644 (file)
@@ -217,10 +217,9 @@ int main(int argc, char **argv)
                                        if (!strcmp(name, "undefined"))
                                                continue;
 
-                                       fwrite(p_start, p - p_start, 1, stdout);
-                                       fputc('(', stdout);
-                                       fputs(name, stdout);
-                                       fputc(')', stdout);
+                                       fwrite(p_start, p - p_start + 1, 1,
+                                              stdout);
+                                       printf(" (%s)", name);
                                        p_start = p + 1;
                                }
                        }
@@ -230,8 +229,6 @@ int main(int argc, char **argv)
                                fwrite(p_start, p - p_start, 1, stdout);
                }
        } else if (all) {
-               extern struct object **objs;
-               extern int nr_objs;
                int i;
 
                for (i = 0; i < nr_objs; i++)