Denton Liu <liu.denton@xxxxxxxxx> writes: > Since in sequencer.c, read_one() basically duplicates the functionality > of read_oneliner(), reduce code duplication by replacing read_one() with > read_oneliner(). > > This was done with the following Coccinelle script > > @@ > expression a, b; > @@ > - read_one(a, b) > + !read_oneliner(b, a, READ_ONELINER_WARN_NON_EXISTENCE) WARN_MISSING, you mean? > -/* Read one file, then strip line endings */ > -static int read_one(const char *path, struct strbuf *buf) > -{ > - if (strbuf_read_file(buf, path, 0) < 0) > - return error_errno(_("could not read '%s'"), path); > - strbuf_trim_trailing_newline(buf); > - return 0; > -} > - OK. Both functions trim the end-of-line marker from the end of the string, so this is truly a no-op that reduces the code. Good.