svn commit: r299355 - in head: bin/pax usr.bin/csplit usr.bin/ctags

Baptiste Daroussin bapt at FreeBSD.org
Tue May 10 11:11:25 UTC 2016


Author: bapt
Date: Tue May 10 11:11:23 2016
New Revision: 299355
URL: https://svnweb.freebsd.org/changeset/base/299355

Log:
  Rename getline with get_line to avoid collision with getline(3)
  
  When getline(3) in 2009 was added a _WITH_GETLINE guard has also been added.
  This rename is made in preparation for the removal of this guard
  
  Obtained from:	NetBSD

Modified:
  head/bin/pax/options.c
  head/usr.bin/csplit/csplit.c
  head/usr.bin/ctags/C.c
  head/usr.bin/ctags/ctags.h
  head/usr.bin/ctags/fortran.c
  head/usr.bin/ctags/lisp.c
  head/usr.bin/ctags/print.c
  head/usr.bin/ctags/yacc.c

Modified: head/bin/pax/options.c
==============================================================================
--- head/bin/pax/options.c	Tue May 10 11:09:26 2016	(r299354)
+++ head/bin/pax/options.c	Tue May 10 11:11:23 2016	(r299355)
@@ -68,7 +68,7 @@ static int no_op(void);
 static void printflg(unsigned int);
 static int c_frmt(const void *, const void *);
 static off_t str_offt(char *);
-static char *getline(FILE *fp);
+static char *get_line(FILE *fp);
 static void pax_options(int, char **);
 static void pax_usage(void);
 static void tar_options(int, char **);
@@ -76,10 +76,10 @@ static void tar_usage(void);
 static void cpio_options(int, char **);
 static void cpio_usage(void);
 
-/* errors from getline */
+/* errors from get_line */
 #define GETLINE_FILE_CORRUPT 1
 #define GETLINE_OUT_OF_MEM 2
-static int getline_error;
+static int get_line_error;
 
 char *chdname;
 
@@ -873,14 +873,14 @@ tar_options(int argc, char **argv)
 						paxwarn(1, "Unable to open file '%s' for read", file);
 						tar_usage();
 					}
-					while ((str = getline(fp)) != NULL) {
+					while ((str = get_line(fp)) != NULL) {
 						if (pat_add(str, dir) < 0)
 							tar_usage();
 						sawpat = 1;
 					}
 					if (strcmp(file, "-") != 0)
 						fclose(fp);
-					if (getline_error) {
+					if (get_line_error) {
 						paxwarn(1, "Problem with file '%s'", file);
 						tar_usage();
 					}
@@ -946,13 +946,13 @@ tar_options(int argc, char **argv)
 					paxwarn(1, "Unable to open file '%s' for read", file);
 					tar_usage();
 				}
-				while ((str = getline(fp)) != NULL) {
+				while ((str = get_line(fp)) != NULL) {
 					if (ftree_add(str, 0) < 0)
 						tar_usage();
 				}
 				if (strcmp(file, "-") != 0)
 					fclose(fp);
-				if (getline_error) {
+				if (get_line_error) {
 					paxwarn(1, "Problem with file '%s'",
 					    file);
 					tar_usage();
@@ -1159,11 +1159,11 @@ cpio_options(int argc, char **argv)
 					paxwarn(1, "Unable to open file '%s' for read", optarg);
 					cpio_usage();
 				}
-				while ((str = getline(fp)) != NULL) {
+				while ((str = get_line(fp)) != NULL) {
 					pat_add(str, NULL);
 				}
 				fclose(fp);
-				if (getline_error) {
+				if (get_line_error) {
 					paxwarn(1, "Problem with file '%s'", optarg);
 					cpio_usage();
 				}
@@ -1258,10 +1258,10 @@ cpio_options(int argc, char **argv)
 			 * no read errors allowed on updates/append operation!
 			 */
 			maxflt = 0;
-			while ((str = getline(stdin)) != NULL) {
+			while ((str = get_line(stdin)) != NULL) {
 				ftree_add(str, 0);
 			}
-			if (getline_error) {
+			if (get_line_error) {
 				paxwarn(1, "Problem while reading stdin");
 				cpio_usage();
 			}
@@ -1489,21 +1489,21 @@ str_offt(char *val)
 }
 
 char *
-getline(FILE *f)
+get_line(FILE *f)
 {
 	char *name, *temp;
 	size_t len;
 
 	name = fgetln(f, &len);
 	if (!name) {
-		getline_error = ferror(f) ? GETLINE_FILE_CORRUPT : 0;
+		get_line_error = ferror(f) ? GETLINE_FILE_CORRUPT : 0;
 		return(0);
 	}
 	if (name[len-1] != '\n')
 		len++;
 	temp = malloc(len);
 	if (!temp) {
-		getline_error = GETLINE_OUT_OF_MEM;
+		get_line_error = GETLINE_OUT_OF_MEM;
 		return(0);
 	}
 	memcpy(temp, name, len-1);

Modified: head/usr.bin/csplit/csplit.c
==============================================================================
--- head/usr.bin/csplit/csplit.c	Tue May 10 11:09:26 2016	(r299354)
+++ head/usr.bin/csplit/csplit.c	Tue May 10 11:11:23 2016	(r299355)
@@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
 static void	 cleanup(void);
 static void	 do_lineno(const char *);
 static void	 do_rexp(const char *);
-static char	*getline(void);
+static char	*get_line(void);
 static void	 handlesig(int);
 static FILE	*newfile(void);
 static void	 toomuch(FILE *, long);
@@ -195,7 +195,7 @@ main(int argc, char *argv[])
 	/* Copy the rest into a new file. */
 	if (!feof(infile)) {
 		ofp = newfile();
-		while ((p = getline()) != NULL && fputs(p, ofp) == 0)
+		while ((p = get_line()) != NULL && fputs(p, ofp) == 0)
 			;
 		if (!sflag)
 			printf("%jd\n", (intmax_t)ftello(ofp));
@@ -270,7 +270,7 @@ cleanup(void)
 
 /* Read a line from the input into a static buffer. */
 static char *
-getline(void)
+get_line(void)
 {
 	static char lbuf[LINE_MAX];
 	FILE *src;
@@ -291,7 +291,7 @@ again: if (fgets(lbuf, sizeof(lbuf), src
 	return (lbuf);
 }
 
-/* Conceptually rewind the input (as obtained by getline()) back `n' lines. */
+/* Conceptually rewind the input (as obtained by get_line()) back `n' lines. */
 static void
 toomuch(FILE *ofp, long n)
 {
@@ -343,7 +343,7 @@ toomuch(FILE *ofp, long n)
 		err(1, "%s", currfile);
 
 	/*
-	 * getline() will read from here. Next call will truncate to
+	 * get_line() will read from here. Next call will truncate to
 	 * truncofs in this file.
 	 */
 	overfile = ofp;
@@ -391,7 +391,7 @@ do_rexp(const char *expr)
 
 	/* Read and output lines until we get a match. */
 	first = 1;
-	while ((p = getline()) != NULL) {
+	while ((p = get_line()) != NULL) {
 		if (fputs(p, ofp) != 0)
 			break;
 		if (!first && regexec(&cre, p, 0, NULL, 0) == 0)
@@ -417,7 +417,7 @@ do_rexp(const char *expr)
 		 * Positive offset: copy the requested number of lines
 		 * after the match.
 		 */
-		while (--ofs > 0 && (p = getline()) != NULL)
+		while (--ofs > 0 && (p = get_line()) != NULL)
 			fputs(p, ofp);
 		toomuch(NULL, 0);
 		nwritten = (intmax_t)ftello(ofp);
@@ -451,7 +451,7 @@ do_lineno(const char *expr)
 	while (nfiles < maxfiles - 1) {
 		ofp = newfile();
 		while (lineno + 1 != lastline) {
-			if ((p = getline()) == NULL)
+			if ((p = get_line()) == NULL)
 				errx(1, "%ld: out of range", lastline);
 			if (fputs(p, ofp) != 0)
 				break;

Modified: head/usr.bin/ctags/C.c
==============================================================================
--- head/usr.bin/ctags/C.c	Tue May 10 11:09:26 2016	(r299354)
+++ head/usr.bin/ctags/C.c	Tue May 10 11:11:23 2016	(r299355)
@@ -151,7 +151,7 @@ c_entries(void)
 				 *	foo\n
 				 *	(arg1,
 				 */
-				getline();
+				get_line();
 				curline = lineno;
 				if (func_entry()) {
 					++level;
@@ -180,7 +180,7 @@ c_entries(void)
 		case ';':
 			if (t_def && level == t_level) {
 				t_def = NO;
-				getline();
+				get_line();
 				if (sp != tok)
 					*sp = EOS;
 				pfnote(tok, lineno);
@@ -225,7 +225,7 @@ c_entries(void)
 						 * get line immediately;
 						 * may change before '{'
 						 */
-						getline();
+						get_line();
 						if (str_entry(c))
 							++level;
 						break;
@@ -369,7 +369,7 @@ hash_entry(void)
 	}
 	*sp = EOS;
 	if (dflag || c == '(') {	/* only want macros */
-		getline();
+		get_line();
 		pfnote(tok, curline);
 	}
 skip:	if (c == '\n') {		/* get rid of rest of define */

Modified: head/usr.bin/ctags/ctags.h
==============================================================================
--- head/usr.bin/ctags/ctags.h	Tue May 10 11:09:26 2016	(r299354)
+++ head/usr.bin/ctags/ctags.h	Tue May 10 11:11:23 2016	(r299355)
@@ -84,7 +84,7 @@ extern char    *lbp;
 extern char	searchar;		/* ex search character */
 
 extern int	cicmp(const char *);
-extern void	getline(void);
+extern void	get_line(void);
 extern void	pfnote(const char *, int);
 extern int	skip_key(int);
 extern void	put_entries(NODE *);

Modified: head/usr.bin/ctags/fortran.c
==============================================================================
--- head/usr.bin/ctags/fortran.c	Tue May 10 11:09:26 2016	(r299354)
+++ head/usr.bin/ctags/fortran.c	Tue May 10 11:11:23 2016	(r299355)
@@ -124,7 +124,7 @@ PF_funcs(void)
 			continue;
 		*cp = EOS;
 		(void)strlcpy(tok, lbp, sizeof(tok));	/* possible trunc */
-		getline();			/* process line for ex(1) */
+		get_line();			/* process line for ex(1) */
 		pfnote(tok, lineno);
 		pfcnt = YES;
 	}

Modified: head/usr.bin/ctags/lisp.c
==============================================================================
--- head/usr.bin/ctags/lisp.c	Tue May 10 11:09:26 2016	(r299354)
+++ head/usr.bin/ctags/lisp.c	Tue May 10 11:11:23 2016	(r299355)
@@ -99,7 +99,7 @@ l_entries(void)
 		*cp = EOS;
 		(void)strlcpy(tok, lbp, sizeof(tok));	/* possible trunc */
 		*cp = savedc;
-		getline();
+		get_line();
 		pfnote(tok, lineno);
 	}
 	/*NOTREACHED*/

Modified: head/usr.bin/ctags/print.c
==============================================================================
--- head/usr.bin/ctags/print.c	Tue May 10 11:09:26 2016	(r299354)
+++ head/usr.bin/ctags/print.c	Tue May 10 11:11:23 2016	(r299355)
@@ -43,12 +43,12 @@ __FBSDID("$FreeBSD$");
 #include "ctags.h"
 
 /*
- * getline --
+ * get_line --
  *	get the line the token of interest occurred on,
  *	prepare it for printing.
  */
 void
-getline(void)
+get_line(void)
 {
 	long	saveftell;
 	int	c;

Modified: head/usr.bin/ctags/yacc.c
==============================================================================
--- head/usr.bin/ctags/yacc.c	Tue May 10 11:09:26 2016	(r299354)
+++ head/usr.bin/ctags/yacc.c	Tue May 10 11:11:23 2016	(r299355)
@@ -98,7 +98,7 @@ y_entries(void)
 			while (GETC(!=, EOF) && (intoken(c) || c == '.'))
 				*sp++ = c;
 			*sp = EOS;
-			getline();		/* may change before ':' */
+			get_line();		/* may change before ':' */
 			while (iswhite(c)) {
 				if (c == '\n')
 					SETLINE;


More information about the svn-src-all mailing list