summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/cvs/diff
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>2001-02-10 18:58:00 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>2001-02-10 18:58:00 +0000
commit7669735f21a4da98b45ab261e6ab994716409388 (patch)
tree414fc50df1e6ea1c162ecde77690b88a14a9bd60 /gnu/usr.bin/cvs/diff
parent9fe669e78968736544dc01ad2f8124de021887ae (diff)
Latest from Cyclic Software
Diffstat (limited to 'gnu/usr.bin/cvs/diff')
-rw-r--r--gnu/usr.bin/cvs/diff/ChangeLog30
-rw-r--r--gnu/usr.bin/cvs/diff/diff.c43
-rw-r--r--gnu/usr.bin/cvs/diff/diff3.c10
3 files changed, 58 insertions, 25 deletions
diff --git a/gnu/usr.bin/cvs/diff/ChangeLog b/gnu/usr.bin/cvs/diff/ChangeLog
index a43518258d0..e3272e84c2d 100644
--- a/gnu/usr.bin/cvs/diff/ChangeLog
+++ b/gnu/usr.bin/cvs/diff/ChangeLog
@@ -1,3 +1,33 @@
+2000-08-03 Larry Jones <larry.jones@sdrc.com>
+
+ * diff3.c (read_diff): Use cvs_temp_name () instead of tmpnam () so
+ there's at least a chance of getting the file in the correct tmp dir.
+
+2000-07-10 Larry Jones <larry.jones@sdrc.com>
+
+ * util.c (printf_output): Fix type clashes.
+
+2000-06-15 Larry Jones <larry.jones@sdrc.com>
+
+ * diff3.c (diff3_run, make_3way_diff): Plug memory leaks.
+
+1999-12-29 Jim Kingdon <http://developer.redhat.com/>
+
+ * diff.c (compare_files): Use explicit braces with if-if-else, per
+ GNU coding standards and gcc -Wall.
+
+1999-11-23 Larry Jones <larry.jones@sdrc.com>
+
+ * diff3.c: Explicitly initialize zero_diff3 to placate neurotic
+ compilers that gripe about implicitly initialized const variables.
+ Reported by Eric Veum <sysv@yahoo.com>.
+
+1999-09-15 Larry Jones <larry.jones@sdrc.com>
+
+ * diff.c (diff_run): Move the setjmp call before the options
+ processing since option errors can call fatal which in turn
+ calls longjmp.
+
1999-05-06 Jim Kingdon <http://www.cyclic.com>
* Makefile.in (DISTFILES): Remove libdiff.mak.
diff --git a/gnu/usr.bin/cvs/diff/diff.c b/gnu/usr.bin/cvs/diff/diff.c
index e5f7e42bfcd..aa91913fe61 100644
--- a/gnu/usr.bin/cvs/diff/diff.c
+++ b/gnu/usr.bin/cvs/diff/diff.c
@@ -247,11 +247,21 @@ diff_run (argc, argv, out, callbacks_arg)
/* Do our initializations. */
initialize_main (&argc, &argv);
-
- /* Decode the options. */
-
optind_old = optind;
optind = 0;
+
+ /* Set the jump buffer, so that diff may abort execution without
+ terminating the process. */
+ val = setjmp (diff_abort_buf);
+ if (val != 0)
+ {
+ optind = optind_old;
+ if (opened_file)
+ fclose (outfile);
+ return val;
+ }
+
+ /* Decode the options. */
while ((c = getopt_long (argc, argv,
"0123456789abBcC:dD:efF:hHiI:lL:nNpPqrsS:tTuU:vwW:x:X:y",
longopts, 0)) != EOF)
@@ -686,17 +696,6 @@ diff_run (argc, argv, out, callbacks_arg)
}
}
- /* Set the jump buffer, so that diff may abort execution without
- terminating the process. */
- val = setjmp (diff_abort_buf);
- if (val != 0)
- {
- optind = optind_old;
- if (opened_file)
- fclose (outfile);
- return val;
- }
-
val = compare_files (0, argv[optind], 0, argv[optind + 1], 0);
/* Print any messages that were saved up for last. */
@@ -1147,13 +1146,15 @@ compare_files (dir0, name0, dir1, name1, depth)
failed = 1;
}
if (inf[1].desc == -2)
- if (same_files)
- inf[1].desc = inf[0].desc;
- else if ((inf[1].desc = open (inf[1].name, O_RDONLY, 0)) < 0)
- {
- perror_with_name (inf[1].name);
- failed = 1;
- }
+ {
+ if (same_files)
+ inf[1].desc = inf[0].desc;
+ else if ((inf[1].desc = open (inf[1].name, O_RDONLY, 0)) < 0)
+ {
+ perror_with_name (inf[1].name);
+ failed = 1;
+ }
+ }
#if HAVE_SETMODE
if (binary_I_O)
diff --git a/gnu/usr.bin/cvs/diff/diff3.c b/gnu/usr.bin/cvs/diff/diff3.c
index e3be1503e86..2f05d165fc9 100644
--- a/gnu/usr.bin/cvs/diff/diff3.c
+++ b/gnu/usr.bin/cvs/diff/diff3.c
@@ -41,6 +41,8 @@ void printf_output PARAMS((char const *, ...))
;
void flush_output PARAMS((void));
+char * cvs_temp_name PARAMS((void));
+
/*
* Internal data structures and macros for the diff3 program; includes
* data structures for both diff3 diffs and normal diffs.
@@ -475,8 +477,6 @@ diff3_run (argc, argv, out, callbacks_arg)
free(content0);
free(content1);
- free_diff_blocks(thread0);
- free_diff_blocks(thread1);
free_diff3_blocks(diff3);
if (! callbacks || ! callbacks->write_output)
@@ -676,7 +676,7 @@ make_3way_diff (thread0, thread1)
struct diff3_block const *last_diff3;
- static struct diff3_block const zero_diff3;
+ static struct diff3_block const zero_diff3 = { 0 };
/* Initialization */
result = 0;
@@ -765,6 +765,8 @@ make_3way_diff (thread0, thread1)
tmpblock = using_to_diff3_block (using, last_using,
base_water_thread, high_water_thread,
last_diff3);
+ free_diff_blocks(using[0]);
+ free_diff_blocks(using[1]);
if (!tmpblock)
diff3_fatal ("internal error: screwup in format of diff blocks");
@@ -1274,7 +1276,7 @@ read_diff (filea, fileb, output_placement)
*ap++ = fileb;
*ap = 0;
- diffout = tmpnam(NULL);
+ diffout = cvs_temp_name ();
outfile_hold = outfile;
callbacks_hold = callbacks;