1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-22 08:58:47 +00:00

Prevent collision with getline(3)

This commit is contained in:
Baptiste Daroussin 2016-05-11 19:49:22 +00:00
parent dca6c80491
commit a7391e54af
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=415022
5 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,29 @@
--- c/finduses.c.orig 2006-06-12 21:16:23 UTC
+++ c/finduses.c
@@ -49,7 +49,7 @@ main(int argc, char **argv) {
#line 155 "finduses.nw"
errormsg(Fatal, "%s: couldn't open temporary file\n", progname);
#line 78 "finduses.nw"
- while ((line = getline(stdin)) != NULL) {
+ while ((line = get_line(stdin)) != NULL) {
if (fputs(line, tmp) == EOF)
#line 157 "finduses.nw"
errormsg(Fatal, "%s: error writing temporary file\n", progname);
@@ -89,7 +89,7 @@ for (; i < argc; i++)
#line 66 "finduses.nw"
static void read_ids(FILE *in) {
char *line;
- while ((line = getline(in)) != NULL) {
+ while ((line = get_line(in)) != NULL) {
if (line[strlen(line)-1] == '\n') line[strlen(line)-1] = 0;
add_ident(nwindex, line);
}
@@ -100,7 +100,7 @@ static void add_use_markers(FILE *in, FI
int incode = 0;
LineOut info; info.line = (char *)0; info.out = out;
- while ((line = getline(in)) != NULL) {
+ while ((line = get_line(in)) != NULL) {
if (is_begin(line, "code") || showquotes && is_keyword(line, "quote"))
incode = 1;
else if (is_end(line, "code") || is_keyword(line, "endquote"))

View File

@ -0,0 +1,25 @@
--- c/getline.c.orig 2006-06-12 21:16:23 UTC
+++ c/getline.c
@@ -19,7 +19,7 @@ void new_buffers(void) {
checkptr(buf2 = (char *) realloc(buf2, buf_size));
}
#line 47 "getline.nw"
-char *getline (FILE *fp) {
+char *get_line (FILE *fp) {
#line 82 "getline.nw"
@@ -40,11 +40,11 @@ if (buf1==NULL) {
return buf1;
}
#line 62 "getline.nw"
-char *getline_expand (FILE *fp) {
+char *get_line_expand (FILE *fp) {
char *s, *t;
int width;
- if (getline(fp)==NULL) return NULL;
+ if (get_line(fp)==NULL) return NULL;
#line 87 "getline.nw"
if (columnwidth(buf1) > buf_size - 1) {

View File

@ -0,0 +1,11 @@
--- c/getline.h.orig 2006-06-12 21:16:23 UTC
+++ c/getline.h
@@ -1,6 +1,6 @@
-char *getline_expand (FILE *fp);
+char *get_line_expand (FILE *fp);
/* grab a line in buffer, return new buffer or NULL for eof
tabs in line are expanded according to tabsize */
-char *getline (FILE *fp);
+char *get_line (FILE *fp);
/* grab a line in the buffer, return a new buffer or NULL for eof
no expansion of tabs */

View File

@ -0,0 +1,11 @@
--- c/markmain.c.orig 2006-06-12 21:16:23 UTC
+++ c/markmain.c
@@ -62,7 +62,7 @@ void markup (FILE* in, FILE *out, char *
#line 121 "markmain.nw"
print_pair(out, "file", filename);
print_state(out, Begin, state, count);
-while ((line = getline_expand(in)) != NULL) {
+while ((line = get_line_expand(in)) != NULL) {
lineno++;
#line 172 "markmain.nw"

View File

@ -0,0 +1,42 @@
--- c/notangle.c.orig 2006-06-12 21:16:23 UTC
+++ c/notangle.c
@@ -44,7 +44,7 @@ void read_defs(FILE *in) {
char *line = NULL; /* buffer for input */
Location loc;
- while ((line = getline(in)) != NULL) {
+ while ((line = get_line(in)) != NULL) {
if (is_keyword(line, "fatal")) exit(1);
#line 101 "notangle.nw"
@@ -90,7 +90,7 @@ if (!is_begin(line, "code"))
#line 66 "notangle.nw"
#line 97 "notangle.nw"
-do { line = getline(in);
+do { line = get_line(in);
} while (line != NULL && !is_keyword(line,"defn") && !is_keyword(line,"text"));
#line 67 "notangle.nw"
insist(line,"defn","code chunk had no definition line");
@@ -102,10 +102,10 @@ modname[strlen(modname)-1]='\0';
warn_dots(modname); /* names ending in ... aren't like web */
modptr = insert(modname); /* find or add module in table */
- line = getline(in);
+ line = get_line(in);
insist(line,"nl","definition line not followed by newline");
loc.lineno++;
- line = getline(in);
+ line = get_line(in);
while (line != NULL && !is_end(line,"code")) {
if (is_keyword(line,"nl")) {
addnewline(modptr);
@@ -157,7 +157,7 @@ modname[strlen(modname)-1]='\0';
#line 182 "notangle.nw"
errorat(loc.filename, loc.lineno, Error, "botched code chunk `%s'", line);
#line 90 "notangle.nw"
- line = getline(in);
+ line = get_line(in);
}
#line 176 "notangle.nw"