Skip to content

Commit 8aa437e

Browse files
author
Carson Howard
committed
tests: ls-files: use puts instead of printf and fix typos
1 parent d7394c3 commit 8aa437e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/ls-files.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
typedef struct {
3030
int error_unmatch;
31-
char * files[1024];
31+
char *files[1024];
3232
size_t file_count;
3333
} ls_options;
3434

@@ -84,13 +84,13 @@ static int print_paths(ls_options *opts, git_index *index)
8484
size_t i;
8585
const git_index_entry *entry;
8686

87-
/* if there are not files explicitly listed by the user print all entries in the index */
87+
/* if there are no files explicitly listed by the user print all entries in the index */
8888
if (opts->file_count == 0) {
8989
size_t entry_count = git_index_entrycount(index);
9090

9191
for (i = 0; i < entry_count; i++) {
9292
entry = git_index_get_byindex(index, i);
93-
printf("%s\n", entry->path);
93+
puts(entry->path);
9494
}
9595
return 0;
9696
}
@@ -100,7 +100,7 @@ static int print_paths(ls_options *opts, git_index *index)
100100
const char *path = opts->files[i];
101101

102102
if ((entry = git_index_get_bypath(index, path, GIT_INDEX_STAGE_NORMAL)) != NULL) {
103-
printf("%s\n", path);
103+
puts(path);
104104
} else if (opts->error_unmatch) {
105105
fprintf(stderr, "error: pathspec '%s' did not match any file(s) known to git.\n", path);
106106
fprintf(stderr, "Did you forget to 'git add'?\n");

0 commit comments

Comments
 (0)