Changeset 3127 in MondoRescue
- Timestamp:
- May 28, 2013, 6:54:03 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mondo/src/lib/mr_mem.c
r2381 r3127 53 53 } 54 54 55 /* encapsulation function for getline */56 void mr_getline_int(char **lineptr, size_t *n, FILE *fd, int line, const char *file) {57 58 ssize_t ret;59 60 ret = getline(lineptr,n,fd);61 if ((ret == -1) && (! feof(fd))) {62 mr_msg_int(1,line,file,"Unable to alloc memory in mr_getline\nExiting...");63 mr_exit(-1,"Unable to alloc memory in mr_getline");64 }65 }66 67 55 /* encapsulation function for asprintf */ 68 56 void mr_asprintf_int(char **strp, int line, const char *file, const char *fmt, ...) { … … 78 66 } 79 67 va_end(args); 68 } 69 70 /* encapsulation function for getline */ 71 void mr_getline_int(char **lineptr, FILE *fd, int line, const char *file) { 72 73 ssize_t ret; 74 size_t n = 0; 75 76 ret = getline(lineptr,&n,fd); 77 if ((ret == -1) && (! feof(fd))) { 78 mr_msg_int(1,line,file,"Unable to alloc memory in mr_getline\nExiting..."); 79 mr_exit(-1,"Unable to alloc memory in mr_getline"); 80 } 81 /* We reached end of file, allocating empty string */ 82 if (ret == -1) { 83 mr_asprintf_int(lineptr, line, file, ""); 84 } 80 85 } 81 86
Note:
See TracChangeset
for help on using the changeset viewer.