Skip to content

Commit

Permalink
Deprecate dcm_init()
Browse files Browse the repository at this point in the history
We can't remove it without breaking ABI, but we can avoid giving the
impression that applications need to call it.
  • Loading branch information
bgilbert committed Oct 14, 2023
1 parent f800b35 commit 448e170
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
5 changes: 0 additions & 5 deletions doc/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ locked to prevent subsequent modification via :c:func:`dcm_sequence_lock()`.
A Sequence is automatically locked when used as a value in a Data Element
with Value Representation SQ (Sequence of Items).

Call :c:func:`dcm_init()` from the main thread during program startup for
libdicom initialisation to be threadsafe. If you do not call this, it will be
triggered for you on first use, but in this case libdicom initialisation will
not be threadsafe.

Error handling
++++++++++++++

Expand Down
17 changes: 11 additions & 6 deletions include/dicom/dicom.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,20 @@ typedef struct _DcmSequence DcmSequence;
/**
* Start up libdicom.
*
* Call this from the main thread during program startup for libdicom to be
* threadsafe.
*
* If you don't do this, libdicom will attempt to call it for you in a safe
* way, but cannot guarantee this on all platforms and with all compilers, and
* therefore cannot guarantee thread safety.
* Call this from the main thread during program startup.
*
* This function can be called many times.
*
* .. deprecated:: 1.0.6
* Calling this function is no longer necessary.
*/
#ifndef BUILDING_LIBDICOM
#if defined(_MSC_VER)
__declspec(deprecated("dcm_init() no longer needs to be called"))
#elif defined(__GNUC__)
__attribute__((deprecated("dcm_init() no longer needs to be called")))
#endif
#endif
DCM_EXTERN
void dcm_init(void);

Expand Down
2 changes: 0 additions & 2 deletions tests/check_dicom.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,6 @@ static Suite *create_file_suite(void)

int main(void)
{
dcm_init();

SRunner *runner = srunner_create(create_main_suite());
srunner_add_suite(runner, create_data_suite());
srunner_add_suite(runner, create_file_suite());
Expand Down
2 changes: 0 additions & 2 deletions tools/dcm-dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ int main(int argc, char *argv[])
{
int i, c;

dcm_init();

while ((c = dcm_getopt(argc, argv, "h?Vv")) != -1) {
switch (c) {
case 'h':
Expand Down
2 changes: 0 additions & 2 deletions tools/dcm-getframe.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ int main(int argc, char *argv[])

int c;

dcm_init();

while ((c = dcm_getopt(argc, argv, "h?Vvo:")) != -1) {
switch (c) {
case 'h':
Expand Down

0 comments on commit 448e170

Please sign in to comment.