commit a2a848a2c08da760904b78a9ecd593785af177f3 from: Stefan Sperling date: Mon Apr 02 18:43:42 2018 UTC remove ignore-lines pattern support from diffreg code commit - f5d549b5bd0aea272b9ba11172ab2a1c7e09c3b6 commit + a2a848a2c08da760904b78a9ecd593785af177f3 blob - 37e980d7221af377e329bdaac4bb55eced6d8906 blob + 79bc75a091b746fd2574988858f8e4b46df7686a --- lib/diffreg.c +++ lib/diffreg.c @@ -198,7 +198,6 @@ static int unsort(struct line *, int, int *); static int change(FILE *, struct got_diff_state *, struct got_diff_args *, const char *, FILE *, const char *, FILE *, int, int, int, int, int *); static void sort(struct line *, int); static void print_header(FILE *, struct got_diff_state *, struct got_diff_args *, const char *, const char *); -static int ignoreline(char *); static int asciifile(FILE *); static int fetch(FILE *, struct got_diff_state *, struct got_diff_args *, long *, int, int, FILE *, int, int, int); static int newcand(struct got_diff_state *, int, int, int, int *); @@ -209,7 +208,6 @@ static int stone(struct got_diff_state *, int *, int, static int readhash(struct got_diff_state *, FILE *, int); static int files_differ(struct got_diff_state *, FILE *, FILE *, int); static char *match_function(struct got_diff_state *, const long *, int, FILE *); -static char *preadline(int, size_t, off_t); /* * chrtran points to one of 2 translation tables: cup2low if folding upper to @@ -938,34 +936,8 @@ uni_range(FILE *outfile, int a, int b) diff_output(outfile, "%d", b); else diff_output(outfile, "%d,0", b); -} - -static char * -preadline(int fd, size_t rlen, off_t off) -{ - char *line; - ssize_t nr; - - line = malloc(rlen + 1); - if (line == NULL) - return NULL; - if ((nr = pread(fd, line, rlen, off)) < 0) { - free(line); - return NULL; - } - if (nr > 0 && line[nr-1] == '\n') - nr--; - line[nr] = '\0'; - return (line); } -static int -ignoreline(char *line) -{ - free(line); - return 0; /* do not ignore any lines */ -} - /* * Indicate that there is a difference between lines a and b of the from file * to get to lines c to d of the to file. If a is greater then b then there @@ -983,38 +955,7 @@ change(FILE *outfile, struct got_diff_state *ds, struc restart: if (args->diff_format != D_IFDEF && a > b && c > d) return (0); - if (args->ignore_pats != NULL) { - char *line; - /* - * All lines in the change, insert, or delete must - * match an ignore pattern for the change to be - * ignored. - */ - if (a <= b) { /* Changes and deletes. */ - for (i = a; i <= b; i++) { - line = preadline(fileno(f1), - ds->ixold[i] - ds->ixold[i - 1], - ds->ixold[i - 1]); - if (line == NULL) - return (-1); - if (!ignoreline(line)) - goto proceed; - } - } - if (a > b || c <= d) { /* Changes and inserts. */ - for (i = c; i <= d; i++) { - line = preadline(fileno(f2), - ds->ixnew[i] - ds->ixnew[i - 1], - ds->ixnew[i - 1]); - if (line == NULL) - return (-1); - if (!ignoreline(line)) - goto proceed; - } - } - return (0); - } -proceed: + if (*pflags & D_HEADER) { diff_output(outfile, "%s %s %s\n", args->diffargs, file1, file2); *pflags &= ~D_HEADER; blob - ffaacf32c07bdd3d1ead6b93b60f8cddeb3a24a1 blob + 5d1b0015e59e2f12d49977e750545c004b211b00 --- lib/got_lib_diff.h +++ lib/got_lib_diff.h @@ -113,7 +113,7 @@ struct got_diff_state { struct got_diff_args { int Tflag; int diff_format, diff_context, status; - char *ifdefname, *diffargs, *ignore_pats; + char *ifdefname, *diffargs; const char *label[2]; };