- assert ((n == 1 && input[offset] == '\n')
- || (n == 2
- && input[offset] == '\r' && input[offset + 1] == '\n'));
- else
- assert (memchr (&input[offset], '\n', n) == NULL);
+ {
+ if (n == 1 ? input[offset] != '\n'
+ : n == 2 ? input[offset] != '\r' || input[offset + 1] != '\n'
+ : false)
+ error (EXIT_FAILURE, 0, "NEWLINE segment at offset %zu contains "
+ "non-newline content \"%.*s\"", offset, n, &input[offset]);
+ }
+ else if (memchr (&input[offset], '\n', n))
+ error (EXIT_FAILURE, 0, "%s segment \"%.*s\" contains new-line",
+ segment_type_to_string (type), n, &input[offset]);