diff --git a/c/output/lrec_writers.c b/c/output/lrec_writers.c index 96ed45a69..313ffb4cc 100644 --- a/c/output/lrec_writers.c +++ b/c/output/lrec_writers.c @@ -45,11 +45,7 @@ lrec_writer_t* lrec_writer_alloc(cli_writer_opts_t* popts) { // ---------------------------------------------------------------- lrec_writer_t* lrec_writer_alloc_or_die(cli_writer_opts_t* popts) { lrec_writer_t* plrec_writer = lrec_writer_alloc(popts); - if (plrec_writer == NULL) { - fprintf(stderr, "%s: internal coding error detected in file \"%s\" at line %d.\n", - MLR_GLOBALS.bargv0, __FILE__, __LINE__); - exit(1); - } + MLR_INTERNAL_CODING_ERROR_IF(plrec_writer == NULL); return plrec_writer; } diff --git a/c/output/multi_lrec_writer.c b/c/output/multi_lrec_writer.c index d07982802..b8f6dabe4 100644 --- a/c/output/multi_lrec_writer.c +++ b/c/output/multi_lrec_writer.c @@ -35,11 +35,7 @@ void multi_lrec_writer_output_srec(multi_lrec_writer_t* pmlw, lrec_t* poutrec, c if (pstate == NULL) { pstate = mlr_malloc_or_die(sizeof(lrec_writer_and_fp_t)); pstate->plrec_writer = lrec_writer_alloc(pmlw->pwriter_opts); - if (pstate->plrec_writer == NULL) { - fprintf(stderr, "%s: internal coding error detected in file \"%s\" at line %d.\n", - MLR_GLOBALS.bargv0, __FILE__, __LINE__); - exit(1); - } + MLR_INTERNAL_CODING_ERROR_IF(pstate->plrec_writer == NULL); pstate->filename_or_command = mlr_strdup_or_die(filename_or_command); char* mode_string = get_mode_string(file_output_mode); char* mode_desc = get_mode_desc(file_output_mode); diff --git a/c/stream/stream.c b/c/stream/stream.c index 794f23fd3..376d15b1c 100644 --- a/c/stream/stream.c +++ b/c/stream/stream.c @@ -29,11 +29,7 @@ int do_stream_chained(char* prepipe, slls_t* filenames, lrec_reader_t* plrec_rea { FILE* output_stream = stdout; - if (pmapper_list->length < 1) { // Should not have been allowed by the CLI parser. - fprintf(stderr, "%s: internal coding error detected at file %s line %d.\n", - MLR_GLOBALS.bargv0, __FILE__, __LINE__); - exit(1); - } + MLR_INTERNAL_CODING_ERROR_IF(pmapper_list->length < 1); // Should not have been allowed by the CLI parser. context_t ctx = { .nr = 0, .fnr = 0, .filenum = 0, .filename = NULL, .force_eof = FALSE }; int ok = 1;