From 9afa7a723c08dd55494947a73ee2b4d3f287ce93 Mon Sep 17 00:00:00 2001 From: Emilien Lemaire Date: Thu, 12 Dec 2024 10:09:25 +0100 Subject: [PATCH] ChangeLog formatting and global variable attribute changes --- libcob/ChangeLog | 3 ++- libcob/fileio.c | 15 ++++++++------- tests/testsuite.src/run_file.at | 1 + 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libcob/ChangeLog b/libcob/ChangeLog index 312b4261..438f184f 100644 --- a/libcob/ChangeLog +++ b/libcob/ChangeLog @@ -1,7 +1,8 @@ + 2024-12-11 Emilien Lemaire * fileio.c: Always use `bdb_app_data` global variable to save the - pointer to the collating sequence function + pointer to the collating sequence function 2024-12-08 Simon Sobisch diff --git a/libcob/fileio.c b/libcob/fileio.c index 2cd6e0c0..7dff24d3 100644 --- a/libcob/fileio.c +++ b/libcob/fileio.c @@ -690,13 +690,14 @@ static unsigned int bdb_lock_id = 0; key.data = fld->data; \ key.size = (cob_dbtsize_t) fld->size -/* #if (DB_VERSION_MAJOR > 4) || ((DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR > 0)) - #define DBT_SET_APP_DATA(key,data) ((key)->app_data = (data)) - #define DBT_GET_APP_DATA(key) ((key)->app_data) - #else -*/ -/* Workaround for older BDB versions that do not have app_data in DBT */ -static void *bdb_app_data = NULL; +/* #if DB_VERSION_MAJOR >= 6 *//* while the fields are part of DBT since 4.1, it wasn't + made part of the public API before 6.0 (DB_VERSION_FAMILY 12); + older versions overwrite that, see bug NNN */ +/* #define DBT_SET_APP_DATA(key,data) ((key)->app_data = (data)) +#define DBT_GET_APP_DATA(key) ((key)->app_data) +#else */ +/* Used to save the collating sequence function, see bug 1032 */ +COB_TLS void *bdb_app_data = NULL; #define DBT_SET_APP_DATA(key,data) ((void)(key), bdb_app_data = (data)) #define DBT_GET_APP_DATA(key) ((void)(key), bdb_app_data) /* #endif */ diff --git a/tests/testsuite.src/run_file.at b/tests/testsuite.src/run_file.at index 54dcadff..0093e1df 100644 --- a/tests/testsuite.src/run_file.at +++ b/tests/testsuite.src/run_file.at @@ -14654,6 +14654,7 @@ AT_CHECK([diff expected.txt prog2.txt]) AT_CLEANUP + AT_SETUP([DELETE WITH COLLATING SEQUENCE]) AT_KEYWORDS([runfile WRITE DELETE READ EBCDIC])