From e8c6f3356012087faa09ed911995d2b633f57d51 Mon Sep 17 00:00:00 2001 From: David Declerck Date: Thu, 25 Jul 2024 22:49:48 +0200 Subject: [PATCH] Fixups --- cobc/parser.y | 1 - libcob/ChangeLog | 37 +++++++++++++++---------------------- libcob/common.c | 26 ++++++++++++++++++++++---- libcob/common.h | 3 ++- libcob/fbdb.c | 2 +- libcob/fextfh.c | 2 +- libcob/flmdb.c | 2 +- libcob/focextfh.c | 2 +- libcob/foci.c | 2 +- libcob/fodbc.c | 2 +- tests/ChangeLog | 3 +++ 11 files changed, 48 insertions(+), 34 deletions(-) diff --git a/cobc/parser.y b/cobc/parser.y index 1c17a5cf0..b03ee7611 100644 --- a/cobc/parser.y +++ b/cobc/parser.y @@ -3181,7 +3181,6 @@ set_record_size (cb_tree min, cb_tree max) %token V %token VALID %token VALIDATE -%token VAL_STATUS "VAL-STATUS" %token VALIDATE_STATUS "VALIDATE-STATUS" %token VALIDATING %token VALUE diff --git a/libcob/ChangeLog b/libcob/ChangeLog index a1e65840c..8f5a19676 100644 --- a/libcob/ChangeLog +++ b/libcob/ChangeLog @@ -1,4 +1,10 @@ +2024-07-25 David Declerck + + * fbdb.c, fextfh.c, fisam.c, flmdb.c, focextfh.c, foci.c, fodbc.c: + adjusted to use cob_open_mode where possible while + merging 2022-10-04 + 2023-07-12 Simon Sobisch * numeric.c (cob_decimal_set_binar): C89 fix @@ -196,8 +202,8 @@ backport of adjusted struct indexed_file with new file_lock_set from rw-branch together with related changes * fileio.c [WITH_DB] (unlock_file): extracted to match other functions - * fileio.c [WITH_DB]: added extra parameters to DB_PUT, DB_GET, DB_SEQ, - DB_CPUT to show what is actually used + * fileio.c [WITH_DB]->fbdb.c: added extra parameters to DB_PUT, DB_GET, + DB_SEQ, DB_CPUT to show what is actually used * fileio.c: fixed some memory leaks related to filename handling * fileio.c (cob_file_free): file was not removed from cache which led to double-free scenarios on cleanup @@ -1016,7 +1022,7 @@ 2021-07-01 Ron Norman - * fbdb.c->fileio.c [WITH_DB]: checks if filename is actually a directory + * fileio.c [WITH_DB]->fbdb.c: checks if filename is actually a directory 2021-06-28 Ron Norman and Christian Lademann @@ -3581,18 +3587,12 @@ 2016-12-30 Ron Norman - * fileio.c,common.h + * fileio.c, common.h: Complete work on BDB use of SHARING & RETRY Problems solved by closing BDB cursor as soon/often as possible as the BDB cursor seems to create some internal locks Retry interval reduced to 100ms - - * INDEXED file test case added and uses a file to synchronize tests - * RELATIVE file test case added and uses a file to synchronize tests - -2016-12-30 Ron Norman - - * fileio.c: [WITH_DB] fixed BDB locking issues by closing BDB cursor as + * fileio.c [WITH_DB]->fbdb.c: fixed BDB locking issues by closing BDB cursor as soon/often as possible as the BDB cursor seems to create some internal locks @@ -3624,7 +3624,7 @@ 2016-12-24 Ron Norman - * fileio.c,common.c,common.h,coblocal.h + * fileio.c, common.c, common.h, coblocal.h: Extensive updates for fileio.c to handle OPEN SHARING and RETRY clauses on all I/O statements. Relative files use sigaction/alarm/fcntl to wait for @@ -3633,18 +3633,11 @@ a wait/retry loop. each loop happens at 125ms interval. BDB code updated to use none deprecated functions, use some subroutines instead of inline code and changes for SHARING/RETRY - - * At present there are no test cases but these will come in a while - I need to come up with a better way to synchronize separate - processes so I can reliably recreate the test cases - -2016-12-24 Ron Norman - - * fileio.c [WITH_DB]: reordered struct indexed_file, adding file_lock_set + * fileio.c [WITH_DB]->fbdb.c: reordered struct indexed_file, adding file_lock_set and use it to fix multiple unlocking - * fileio.c [WITH_DB]: extracted bdb_open_cursor, bdb_close_cursor, + * fileio.c [WITH_DB]->fbdb.c: extracted bdb_open_cursor, bdb_close_cursor, bdb_close_index, lock_file - * fileio.c [WITH_DB]: added code for BDB < 4.6 + * fileio.c [WITH_DB]->fbdb.c: added code for BDB < 4.6 2016-12-23 Simon Sobisch diff --git a/libcob/common.c b/libcob/common.c index ab6220413..46ffc7527 100644 --- a/libcob/common.c +++ b/libcob/common.c @@ -2604,16 +2604,26 @@ cob_set_exception (const int id) static char excp_para[COB_MAX_WORDLEN + 1]; cob_module *mod = COB_MODULE_PTR; cobglobptr->cob_got_exception = 1; - cobglobptr->last_exception_source = cob_source_file; /* needs to be strdup'd */ +#if 0 /* consider addition for 4.x */ cobglobptr->last_exception_line = cob_source_line; +#endif if (mod) { +#if 0 /* consider addition for 4.x */ if (mod->module_sources && mod->module_stmt != 0) { /* note: it is likely best to not copy name + line but store the name+line together, maybe even comma-separated when we have copy->copy-prog */ - cobglobptr->last_exception_source = mod->module_sources - [COB_GET_FILE_NUM (mod->module_stmt)]; /* needs to be strdup'd */ + cobglobptr->last_exception_source = cob_strdup (mod->module_sources + [COB_GET_FILE_NUM (mod->module_stmt)]); + cobglobptr->last_exception_line = COB_GET_LINE_NUM (mod->module_stmt); + } else { + if (cob_source_file != NULL) { + cobglobptr->last_exception_source = cob_strdup (cob_source_file); + } +#else + if (mod->module_stmt != 0) { cobglobptr->last_exception_line = COB_GET_LINE_NUM (mod->module_stmt); +#endif } cobglobptr->last_exception_statement = mod->statement; if (mod->module_name) { @@ -2629,14 +2639,22 @@ cob_set_exception (const int id) cobglobptr->last_exception_paragraph = excp_para; } return; +#if 0 /* consider addition for 4.x */ + } else { + if (cob_source_file != NULL) { + cobglobptr->last_exception_source = cob_strdup (cob_source_file); + } +#endif } /* if no current module is available fall-through */ } else { cobglobptr->cob_got_exception = 0; +#if 0 /* consider addition for 4.x */ if (cobglobptr->last_exception_source) { - cobglobptr->last_exception_source = NULL; cob_free ((void *)cobglobptr->last_exception_source); + cobglobptr->last_exception_source = NULL; } +#endif cobglobptr->last_exception_line = 0; } } diff --git a/libcob/common.h b/libcob/common.h index 86d9ff618..66fac9f60 100644 --- a/libcob/common.h +++ b/libcob/common.h @@ -1820,8 +1820,9 @@ typedef struct __cob_global { unsigned int cob_stmt_exception; /* Statement has 'On Exception' */ unsigned int cob_debugging_mode; /* activation of USE ON DEBUGGING code */ +#if 0 /* consider addition for 4.x */ const char *last_exception_source; /* Last exception: Source */ - +#endif } cob_global; #ifndef COB_WITHOUT_JMP diff --git a/libcob/fbdb.c b/libcob/fbdb.c index 5a006fe41..d79bc8603 100644 --- a/libcob/fbdb.c +++ b/libcob/fbdb.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2012, 2014-2022 Free Software Foundation, Inc. + Copyright (C) 2002-2012, 2014-2022, 2024 Free Software Foundation, Inc. Written by Keisuke Nishida, Roger While, Simon Sobisch, Ron Norman This file is part of GnuCOBOL. diff --git a/libcob/fextfh.c b/libcob/fextfh.c index 0d16560de..b5cebb2be 100644 --- a/libcob/fextfh.c +++ b/libcob/fextfh.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2012, 2014-2022 Free Software Foundation, Inc. + Copyright (C) 2002-2012, 2014-2022, 2024 Free Software Foundation, Inc. Written by Keisuke Nishida, Roger While, Simon Sobisch, Ron Norman This file is part of GnuCOBOL. diff --git a/libcob/flmdb.c b/libcob/flmdb.c index 0ce3bf3ff..d9056a422 100644 --- a/libcob/flmdb.c +++ b/libcob/flmdb.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2012, 2014-2022 Free Software Foundation, Inc. + Copyright (C) 2002-2012, 2014-2022, 2024 Free Software Foundation, Inc. Written by Keisuke Nishida, Roger While, Simon Sobisch, Ron Norman This file is part of GnuCOBOL. diff --git a/libcob/focextfh.c b/libcob/focextfh.c index a071d59cd..4e1f6b0dd 100644 --- a/libcob/focextfh.c +++ b/libcob/focextfh.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2012, 2014-2022 Free Software Foundation, Inc. + Copyright (C) 2002-2012, 2014-2022, 2024 Free Software Foundation, Inc. Written by Keisuke Nishida, Roger While, Simon Sobisch, Ron Norman This file is part of GnuCOBOL. diff --git a/libcob/foci.c b/libcob/foci.c index 79a520f96..1b0016512 100644 --- a/libcob/foci.c +++ b/libcob/foci.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2012, 2014-2022 Free Software Foundation, Inc. + Copyright (C) 2002-2012, 2014-2022, 2024 Free Software Foundation, Inc. Written by Keisuke Nishida, Roger While, Simon Sobisch, Ron Norman This file is part of GnuCOBOL. diff --git a/libcob/fodbc.c b/libcob/fodbc.c index 9d8e64849..0b41d63bc 100644 --- a/libcob/fodbc.c +++ b/libcob/fodbc.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2012, 2014-2022 Free Software Foundation, Inc. + Copyright (C) 2002-2012, 2014-2022, 2024 Free Software Foundation, Inc. Written by Keisuke Nishida, Roger While, Simon Sobisch, Ron Norman This file is part of GnuCOBOL. diff --git a/tests/ChangeLog b/tests/ChangeLog index ff68f5671..7870f2ff4 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -501,6 +501,9 @@ run concurrent test cases. There is also several C$SLEEP calls to setup the test scenarios. So these tests appear to run for a long time + * INDEXED file test case added and uses a file to synchronize tests + * RELATIVE file test case added and uses a file to synchronize tests + 2016-12-06 Simon Sobisch