Lines Matching refs:current

79 /* Get ready to read the current file.
84 sip (current, skip_test)
85 struct file_data *current;
89 if (current->desc < 0)
92 current->bufsize = sizeof (word);
93 current->buffer = xmalloc (current->bufsize);
97 current->bufsize = STAT_BLOCKSIZE (current->stat);
98 current->buffer = xmalloc (current->bufsize);
104 int oldmode = setmode (current->desc, O_BINARY);
106 ssize_t n = read (current->desc, current->buffer, current->bufsize);
108 pfatal_with_name (current->name);
109 current->buffered_chars = n;
113 if (lseek (current->desc, - (off_t) n, SEEK_CUR) == -1)
114 pfatal_with_name (current->name);
115 setmode (current->desc, oldmode);
116 current->buffered_chars = 0;
119 return binary_file_p (current->buffer, n);
123 current->buffered_chars = 0;
127 /* Slurp the rest of the current file completely into memory. */
130 slurp (current)
131 struct file_data *current;
135 if (current->desc < 0)
138 else if (S_ISREG (current->stat.st_mode))
144 cc = current->stat.st_size + 1 + sizeof (word);
145 if (current->bufsize < cc)
147 current->bufsize = cc;
148 current->buffer = xrealloc (current->buffer, cc);
151 if (current->buffered_chars < current->stat.st_size)
153 cc = read (current->desc,
154 current->buffer + current->buffered_chars,
155 current->stat.st_size - current->buffered_chars);
157 pfatal_with_name (current->name);
158 current->buffered_chars += cc;
162 else if (always_text_flag || current->buffered_chars != 0)
166 if (current->buffered_chars == current->bufsize)
168 current->bufsize = current->bufsize * 2;
169 current->buffer = xrealloc (current->buffer, current->bufsize);
171 cc = read (current->desc,
172 current->buffer + current->buffered_chars,
173 current->bufsize - current->buffered_chars);
177 pfatal_with_name (current->name);
178 current->buffered_chars += cc;
181 current->bufsize = current->buffered_chars + 1 + sizeof (word);
182 current->buffer = xrealloc (current->buffer, current->bufsize);
191 find_and_hash_each_line (current)
192 struct file_data *current;
195 unsigned char const *p = (unsigned char const *) current->prefix_end;
201 char const **linbuf = current->linbuf;
202 int alloc_lines = current->alloc_lines;
204 int linbuf_base = current->linbuf_base;
209 char const *suffix_begin = current->suffix_begin;
210 char const *bufend = current->buffer + current->buffered_chars;
288 && current->missing_newline
347 current->buffered_lines = line;
378 current->linbuf = linbuf;
379 current->valid_lines = line;
380 current->alloc_lines = alloc_lines;
381 current->equivs = cureqs;
393 prepare_text_end (current)
394 struct file_data *current;
396 size_t buffered_chars = current->buffered_chars;
397 char *p = current->buffer;
400 current->missing_newline = 0;
404 current->buffered_chars = buffered_chars;
405 current->missing_newline = 1;