#include <stdio.h>#include <stdlib.h>Include dependency graph for util.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| void | read_one_line (char **buff, int *stop, FILE *fd, int *buflen) |
Definition at line 8 of file util.c.
References i, NULL, and realloc().
Referenced by get_dims(), and Sed().
00009 { 00010 int i ,c ; 00011 for ( i = 0 ; (c =getc(fd)) != '\n' && c != EOF ; i++) 00012 { 00013 if ( i == *buflen -1 ) 00014 { 00015 *buflen += 512; 00016 *buff = realloc(*buff,*buflen*sizeof(char)); 00017 if ( *buff == NULL) 00018 { 00019 fprintf(stderr,"Running out of space \n"); 00020 exit(1); 00021 } 00022 } 00023 (*buff)[i]= c ; 00024 } 00025 if ( i+1 >= *buflen - 1 ) 00026 { 00027 *buflen += 512; 00028 *buff = realloc(*buff,*buflen*sizeof(char)); 00029 if ( *buff == NULL) 00030 { 00031 fprintf(stderr,"Running out of space \n"); 00032 exit(1); 00033 } 00034 } 00035 (*buff)[i]='\n'; 00036 (*buff)[i+1]='\0'; 00037 if ( c == EOF) {*stop = 1;} 00038 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.5.1