summaryrefslogtreecommitdiff
path: root/builtin-update-index.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-update-index.c')
-rw-r--r--builtin-update-index.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 55fb679d68..acd5ab5926 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -4,7 +4,6 @@
* Copyright (C) Linus Torvalds, 2005
*/
#include "cache.h"
-#include "strbuf.h"
#include "quote.h"
#include "cache-tree.h"
#include "tree-walk.h"
@@ -296,7 +295,7 @@ static void update_one(const char *path, const char *prefix, int prefix_length)
static void read_index_info(int line_termination)
{
struct strbuf buf;
- strbuf_init(&buf);
+ strbuf_init(&buf, 0);
while (1) {
char *ptr, *tab;
char *path_name;
@@ -321,8 +320,7 @@ static void read_index_info(int line_termination)
* This format is to put higher order stages into the
* index file and matches git-ls-files --stage output.
*/
- read_line(&buf, stdin, line_termination);
- if (buf.eof)
+ if (strbuf_getline(&buf, stdin, line_termination) == EOF)
break;
errno = 0;
@@ -384,6 +382,7 @@ static void read_index_info(int line_termination)
bad_line:
die("malformed index info %s", buf.buf);
}
+ strbuf_release(&buf);
}
static const char update_index_usage[] =
@@ -707,12 +706,11 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
}
if (read_from_stdin) {
struct strbuf buf;
- strbuf_init(&buf);
+ strbuf_init(&buf, 0);
while (1) {
char *path_name;
const char *p;
- read_line(&buf, stdin, line_termination);
- if (buf.eof)
+ if (strbuf_getline(&buf, stdin, line_termination) == EOF)
break;
if (line_termination && buf.buf[0] == '"')
path_name = unquote_c_style(buf.buf, NULL);
@@ -727,6 +725,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
if (path_name != buf.buf)
free(path_name);
}
+ strbuf_release(&buf);
}
finish: