void *safe_malloc(size_t n) {
void *p = malloc(n);
if (!p && n != 0) {
- printf("Can not allocate memory: %s\n", strerror(errno));
+ fprintf(stderr,
+ "selector: can not allocate memory: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
return p;
exit(EXIT_FAILURE);
}
- while(*nb_lines < nb_lines_max && (fgets(raw_line, BUFFER_SIZE, file))) {
+ while(*nb_lines < nb_lines_max && fgets(raw_line, BUFFER_SIZE, file)) {
for(s = raw_line + strlen(raw_line) - 1; s > raw_line && *s == '\n'; s--) {
*s = '\0';
}