From 40a9f147990ed4668870100c897a8ded4754ba1f Mon Sep 17 00:00:00 2001 From: ivmai Date: Mon, 28 Sep 2009 09:06:06 +0000 Subject: [PATCH] 2009-09-28 Ivan Maidanski * alloc.c (GC_version): Add "const" keyword. * alloc.c (GC_get_version): New public function. * include/gc.h (GC_get_version): New function declaration; update the comment for the GC version. --- ChangeLog | 9 ++++++++- alloc.c | 14 +++++++++----- include/gc.h | 8 ++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb48a3e4..1a2de3c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-09-28 Ivan Maidanski + + * alloc.c (GC_version): Add "const" keyword. + * alloc.c (GC_get_version): New public function. + * include/gc.h (GC_get_version): New function declaration; update + the comment for the GC version. + 2009-09-27 Ivan Maidanski * include/private/gc_locks.h (GC_allocate_ml, GC_lock_holder, @@ -1766,7 +1773,7 @@ * win32_threads.c (GC_wait_marker): Remove FIXME and use "release" version of AO_fetch_and_sub1(). * win32_threads.c (GC_win32_start_inner, GC_win32_start): convert int - to pointer (and vice verse) thru word type to suppress warnings. + to pointer (and vice versa) thru word type to suppress warnings. * win32_threads.c (GC_mark_mutex_waitcnt): Fix comment, always access atomically. * misc.c: Change GC_THREADS tests back to THREADS. diff --git a/alloc.c b/alloc.c index 0cb411c3..a1b11309 100644 --- a/alloc.c +++ b/alloc.c @@ -92,13 +92,17 @@ char * GC_copyright[] = "See source code for details." }; /* Version macros are now defined in gc_version.h, which is included by */ -/* gc.h, which is included by gc_priv.h". */ - +/* gc.h, which is included by gc_priv.h. */ #ifndef GC_NO_VERSION_VAR + const unsigned GC_version = ((GC_VERSION_MAJOR << 16) | + (GC_VERSION_MINOR << 8) | GC_TMP_ALPHA_VERSION); +#endif -unsigned GC_version = ((GC_VERSION_MAJOR << 16) | (GC_VERSION_MINOR << 8) | GC_TMP_ALPHA_VERSION); - -#endif /* GC_NO_VERSION_VAR */ +GC_API unsigned GC_CALL GC_get_version(void) +{ + return (GC_VERSION_MAJOR << 16) | (GC_VERSION_MINOR << 8) | + GC_TMP_ALPHA_VERSION; +} /* some more variables */ diff --git a/include/gc.h b/include/gc.h index db0813e2..cc774648 100644 --- a/include/gc.h +++ b/include/gc.h @@ -35,8 +35,8 @@ /* Define version numbers here to allow test on build machine */ /* for cross-builds. Note that this defines the header */ /* version number, which may or may not match that of the */ - /* dynamic library. The GC_version variable can be used */ - /* to obtain the latter. */ + /* dynamic library. GC_get_version() can be used to obtain */ + /* the latter. */ # include "gc_config_macros.h" @@ -65,6 +65,10 @@ #endif #endif +/* Get the GC library version. The returned value is in the form: */ +/* ((version_major<<16) | (version_minor<<8) | alpha_version). */ +GC_API unsigned GC_CALL GC_get_version(void); + /* Public read-only variables */ /* The supplied getter functions are preferred for new code. */ -- 2.40.0