Skip to content

Commit 2481763

Browse files
committed
ly_common UPDATE make global ctx data static
1 parent 404ed52 commit 2481763

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

src/ly_common.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@
4343
#include "version.h"
4444
#include "xml.h"
4545

46-
/* lock for creating/destroying ctx data */
47-
pthread_rwlock_t ly_ctx_data_rwlock = PTHREAD_RWLOCK_INITIALIZER;
46+
/**< lock for creating and destroying both private & shared context data */
47+
static pthread_rwlock_t ly_ctx_data_rwlock = PTHREAD_RWLOCK_INITIALIZER;
4848

49-
/* sized array of thread-specific context data */
50-
struct ly_ctx_private_data *ly_private_ctx_data;
49+
/**< sized array ([sized array](@ref sizedarrays)) of private context data.
50+
* The context is identified by the thread ID of the thread that created it and its address. */
51+
static struct ly_ctx_private_data *ly_private_ctx_data;
5152

52-
/* sized array of shared context data */
53-
struct ly_ctx_shared_data *ly_shared_ctx_data;
53+
/**< sized array ([sized array](@ref sizedarrays)) of shared context data.
54+
* The context is identified by the memory address of the context. */
55+
static struct ly_ctx_shared_data *ly_shared_ctx_data;
5456

5557
LIBYANG_API_DEF uint32_t
5658
ly_version_so_major(void)

src/ly_common.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,6 @@ struct ly_ctx_shared_data {
374374
struct ly_ht *leafref_links_ht; /**< hash table of leafref links between term data nodes */
375375
};
376376

377-
extern pthread_rwlock_t ly_ctx_data_rwlock; /**< lock for creating and destroying both private & shared context data */
378-
extern struct ly_ctx_private_data *ly_private_ctx_data; /**< sized array ([sized array](@ref sizedarrays)) of private context data.
379-
* The context is identified by the thread ID of the thread that created it
380-
* and its address. */
381-
extern struct ly_ctx_shared_data *ly_shared_ctx_data; /**< sized array ([sized array](@ref sizedarrays)) of shared context data.
382-
* The context is identified by the memory address of the context. */
383-
384377
#define LY_CTX_INT_IMMUTABLE 0x80000000 /**< marks a context that was printed into a fixed-size memory block and
385378
can even be shared between processes so it cannot be changed */
386379

0 commit comments

Comments
 (0)