Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 May 2016 19:44:21 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r415145 - head/textproc/mgdiff/files
Message-ID:  <201605131944.u4DJiL4j076581@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Fri May 13 19:44:21 2016
New Revision: 415145
URL: https://svnweb.freebsd.org/changeset/ports/415145

Log:
  Prevent collision with getline(3)

Added:
  head/textproc/mgdiff/files/patch-rundiff.c   (contents, props changed)

Added: head/textproc/mgdiff/files/patch-rundiff.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/mgdiff/files/patch-rundiff.c	Fri May 13 19:44:21 2016	(r415145)
@@ -0,0 +1,92 @@
+--- rundiff.c.orig	1994-05-19 02:01:22 UTC
++++ rundiff.c
+@@ -63,7 +63,7 @@ typedef enum { ADD = 1, CHANGE, DELETE, 
+ static char *duplicate (char *s, int *flag);
+ static DiffType parse_diff_line (char *buf, int *f1n1, int *f1n2, int *f2n1, int *f2n2);
+ static int eatline (FILE *f);
+-static void getline (FILE *f, char **cooked, char **raw);
++static void get_line (FILE *f, char **cooked, char **raw);
+ static void reset_blist (void);
+ static Block *get_blist (void);
+ static void add_blist (Block *b);
+@@ -271,7 +271,7 @@ DiffInfo *build_diff_info (char *prog, c
+ 		b->arr[LEFT].wtext = (char **) calloc (b->arr[LEFT].fsize, sizeof (char *));
+ 		b->arr[LEFT].tlen = (short *) calloc (b->arr[LEFT].fsize, sizeof (short));
+ 		for (i = 0; i < b->arr[LEFT].fsize; i++) {
+-		    getline (file1, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
++		    get_line (file1, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
+ 		    b->arr[LEFT].tlen[i] = strlen (b->arr[LEFT].text[i]);
+ 		    if (di->maxcols < b->arr[LEFT].tlen[i]) {
+ 			di->maxcols = b->arr[LEFT].tlen[i];
+@@ -300,7 +300,7 @@ DiffInfo *build_diff_info (char *prog, c
+ 	    b->arr[RIGHT].wtext = (char **) calloc (b->arr[RIGHT].fsize, sizeof (char *));
+ 	    b->arr[RIGHT].tlen = (short *) calloc (b->arr[RIGHT].fsize, sizeof (short));
+ 	    for (i = 0; i < b->arr[RIGHT].fsize; i++) {
+-		getline (file2, &b->arr[RIGHT].text[i], &b->arr[RIGHT].wtext[i]);
++		get_line (file2, &b->arr[RIGHT].text[i], &b->arr[RIGHT].wtext[i]);
+ 		b->arr[RIGHT].tlen[i] = strlen (b->arr[RIGHT].text[i]);
+ 		if (di->maxcols < b->arr[RIGHT].tlen[i]) {
+ 		    di->maxcols = b->arr[RIGHT].tlen[i];
+@@ -331,7 +331,7 @@ DiffInfo *build_diff_info (char *prog, c
+ 		b->arr[LEFT].wtext = (char **) calloc (b->arr[LEFT].fsize, sizeof (char *));
+ 		b->arr[LEFT].tlen = (short *) calloc (b->arr[LEFT].fsize, sizeof (short));
+ 		for (i = 0; i < b->arr[LEFT].fsize; i++) {
+-		    getline (file1, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
++		    get_line (file1, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
+ 		    b->arr[LEFT].tlen[i] = strlen (b->arr[LEFT].text[i]);
+ 		    if (di->maxcols < b->arr[LEFT].tlen[i]) {
+ 			di->maxcols = b->arr[LEFT].tlen[i];
+@@ -358,7 +358,7 @@ DiffInfo *build_diff_info (char *prog, c
+ 	    b->arr[LEFT].wtext = (char **) calloc (b->arr[LEFT].fsize, sizeof (char *));
+ 	    b->arr[LEFT].tlen = (short *) calloc (b->arr[LEFT].fsize, sizeof (short));
+ 	    for (i = 0; i < b->arr[LEFT].fsize; i++) {
+-		getline (file1, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
++		get_line (file1, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
+ 		b->arr[LEFT].tlen[i] = strlen (b->arr[LEFT].text[i]);
+ 		if (di->maxcols < b->arr[LEFT].tlen[i]) {
+ 		    di->maxcols = b->arr[LEFT].tlen[i];
+@@ -371,7 +371,7 @@ DiffInfo *build_diff_info (char *prog, c
+ 	    b->arr[RIGHT].wtext = (char **) calloc (b->arr[RIGHT].fsize, sizeof (char *));
+ 	    b->arr[RIGHT].tlen = (short *) calloc (b->arr[RIGHT].fsize, sizeof (short));
+ 	    for (i = 0; i < b->arr[RIGHT].fsize; i++) {
+-		getline (file2, &b->arr[RIGHT].text[i], &b->arr[RIGHT].wtext[i]);
++		get_line (file2, &b->arr[RIGHT].text[i], &b->arr[RIGHT].wtext[i]);
+ 		b->arr[RIGHT].tlen[i] = strlen (b->arr[RIGHT].text[i]);
+ 		if (di->maxcols < b->arr[RIGHT].tlen[i]) {
+ 		    di->maxcols = b->arr[RIGHT].tlen[i];
+@@ -399,7 +399,7 @@ DiffInfo *build_diff_info (char *prog, c
+ 		b->arr[LEFT].wtext = (char **) calloc (b->arr[LEFT].fsize, sizeof (char *));
+ 		b->arr[LEFT].tlen = (short *) calloc (b->arr[LEFT].fsize, sizeof (short));
+ 		for (i = 0; i < b->arr[LEFT].fsize; i++) {
+-		    getline (file1, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
++		    get_line (file1, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
+ 		    b->arr[LEFT].tlen[i] = strlen (b->arr[LEFT].text[i]);
+ 		    if (di->maxcols < b->arr[LEFT].tlen[i]) {
+ 			di->maxcols = b->arr[LEFT].tlen[i];
+@@ -428,7 +428,7 @@ DiffInfo *build_diff_info (char *prog, c
+ 	    b->arr[LEFT].wtext = (char **) calloc (b->arr[LEFT].fsize, sizeof (char *));
+ 	    b->arr[LEFT].tlen = (short *) calloc (b->arr[LEFT].fsize, sizeof (short));
+ 	    for (i = 0; i < b->arr[LEFT].fsize; i++) {
+-		getline (file1, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
++		get_line (file1, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
+ 		b->arr[LEFT].tlen[i] = strlen (b->arr[LEFT].text[i]);
+ 		if (di->maxcols < b->arr[LEFT].tlen[i]) {
+ 		    di->maxcols = b->arr[LEFT].tlen[i];
+@@ -491,7 +491,7 @@ DiffInfo *build_diff_info (char *prog, c
+ 	b->arr[LEFT].wtext = (char **) calloc (b->arr[LEFT].fsize, sizeof (char *));
+ 	b->arr[LEFT].tlen = (short *) calloc (b->arr[LEFT].fsize, sizeof (short));
+  	for (i = 0; i < b->arr[LEFT].fsize; i++) {
+-	    getline (file2, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
++	    get_line (file2, &b->arr[LEFT].text[i], &b->arr[LEFT].wtext[i]);
+ 	    b->arr[LEFT].tlen[i] = strlen (b->arr[LEFT].text[i]);
+ 	    if (di->maxcols < b->arr[LEFT].tlen[i]) {
+ 		di->maxcols = b->arr[LEFT].tlen[i];
+@@ -663,7 +663,7 @@ static int eatline (FILE *f)
+  * printable) if necessary.  Silently truncate input lines at BUFSIZ
+  * characters.
+  */
+-static void getline (FILE *f, char **cooked, char **raw)
++static void get_line (FILE *f, char **cooked, char **raw)
+ {
+     char buffer[BUFSIZ+1];
+     char *s;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605131944.u4DJiL4j076581>