From 566a8dce041db37517dec8f3166d7fe1f5206a92 Mon Sep 17 00:00:00 2001 From: Joaquim Date: Mon, 4 Dec 2023 11:32:38 +0000 Subject: [PATCH] Only reset the column type at level zero. (#8124) This doesn't affect the CLI because it will end anyway but makes a difference for externals that keep the API alive between module calls. Fixes #8115 --- src/gmt_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gmt_init.c b/src/gmt_init.c index 369ba06c940..9d5ed5adfac 100644 --- a/src/gmt_init.c +++ b/src/gmt_init.c @@ -16635,7 +16635,8 @@ void gmt_end_module (struct GMT_CTRL *GMT, struct GMT_CTRL *Ccopy) { GMT->current.io.col[GMT_OUT][i].col = GMT->current.io.col[GMT_OUT][i].order = i; /* Default order */ for (i = 0; i < 2; i++) GMT->current.io.skip_if_NaN[i] = true; /* x/y must be non-NaN */ - for (i = 0; i < 2; i++) gmt_set_column_type (GMT, GMT_IO, i, GMT_IS_UNKNOWN); /* Must be told [or find out] what x/y are */ + if (GMT->hidden.func_level == 0) /* Only when top-level module ends. Doesn't affect CLI but useful for externals */ + for (i = 0; i < 2; i++) gmt_set_column_type (GMT, GMT_IO, i, GMT_IS_UNKNOWN); /* Must be told [or find out] what x/y are */ for (i = 2; i < GMT_MAX_COLUMNS; i++) gmt_set_column_type (GMT, GMT_IO, i, GMT_IS_FLOAT); /* Other columns default to floats */ gmt_M_memset (GMT->current.io.col_set[GMT_X], GMT_MAX_COLUMNS, char); /* This is the initial state of input columns - all available to be changed by modules */ gmt_M_memset (GMT->current.io.col_set[GMT_Y], GMT_MAX_COLUMNS, char); /* This is the initial state of output columns - all available to be changed by modules */