From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 21:14:10 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 801B7106566C for ; Mon, 25 Jun 2012 21:14:08 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 21:14:08 +0000 Date: Mon, 25 Jun 2012 21:14:08 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625211408.801B7106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238286 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 21:14:10 -0000 Author: jhagewood Date: Mon Jun 25 21:14:08 2012 New Revision: 238286 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238286 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 20:56:32 2012 (r238285) +++ soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 21:14:08 2012 (r238286) @@ -1344,6 +1344,9 @@ return (sum == 0 ? 1 : sum); } +/* + * Checks if an open file is a text file. + */ static int istextfile(FILE *f) { @@ -1353,6 +1356,9 @@ if (aflag || f == NULL) return (1); rewind(f); + /* If the first 4 bytes of the file are the same as the first 4 bytes of + * an ELF file header, return 0. + */ fread(buf, 1, sizeof(buf), f); if(buf[0] == 0x7F && buf[1] == 0x45 && buf[2] == 0x4C && buf[3] == 0x46) Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 20:56:32 2012 (r238285) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 21:14:08 2012 (r238286) @@ -537,7 +537,7 @@ if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-25 19:58:16.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-25 21:14:04.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -1042,9 +1042,13 @@ sum = 1; space = 0; -@@ -1306,18 +1345,17 @@ readhash(FILE *f) +@@ -1305,19 +1344,24 @@ readhash(FILE *f) + return (sum == 0 ? 1 : sum); } ++/* ++ * Checks if an open file is a text file. ++ */ static int -asciifile(FILE *f) +istextfile(FILE *f) @@ -1061,13 +1065,16 @@ - cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) ++ /* If the first 4 bytes of the file are the same as the first 4 bytes of ++ * an ELF file header, return 0. ++ */ + fread(buf, 1, sizeof(buf), f); + if(buf[0] == 0x7F && buf[1] == 0x45 && + buf[2] == 0x4C && buf[3] == 0x46) return (0); return (1); } -@@ -1327,10 +1365,10 @@ asciifile(FILE *f) +@@ -1327,10 +1371,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1082,7 +1089,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1380,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1386,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1090,7 +1097,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1410,9 @@ static void +@@ -1373,9 +1416,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1103,7 +1110,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1427,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1433,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1114,7 +1121,7 @@ } } printf("\n*** "); -@@ -1478,9 +1515,9 @@ static void +@@ -1478,9 +1521,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1127,7 +1134,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1528,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1534,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1153,7 +1160,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1588,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1594,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) {