Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EED6CD4EA for ; Mon, 10 Sep 2012 23:22:17 +0000 (UTC) Received: (qmail 20923 invoked by uid 500); 10 Sep 2012 23:22:17 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 20877 invoked by uid 500); 10 Sep 2012 23:22:17 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 20869 invoked by uid 99); 10 Sep 2012 23:22:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Sep 2012 23:22:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Sep 2012 23:22:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 53D8723888E4; Mon, 10 Sep 2012 23:21:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1383149 - in /subversion/trunk/subversion: include/svn_version.h libsvn_subr/opt.c libsvn_subr/sysinfo.c libsvn_subr/version.c Date: Mon, 10 Sep 2012 23:21:29 -0000 To: commits@subversion.apache.org From: brane@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120910232129.53D8723888E4@eris.apache.org> Author: brane Date: Mon Sep 10 23:21:28 2012 New Revision: 1383149 URL: http://svn.apache.org/viewvc?rev=1383149&view=rev Log: Make the extended version info an opaque type. * subversion/include/svn_version.h (svn_version_extended_t): Remove definition, leaving only a forward-declared typedef. (svn_version_ext_linked_lib_t): Renamed from svn_version_linked_lib_t. (svn_version_ext_loaded_lib_t): Renamed from svn_version_loaded_lib_t. (svn_version_extended): Update docstring. (svn_version_ext_build_date, svn_version_ext_build_time, svn_version_ext_build_host, svn_version_ext_copyright, svn_version_ext_runtime_host, svn_version_ext_runtime_osname, svn_version_ext_linked_libs, svn_version_ext_loaded_libs): New; accessor functions for svn_version_extended_t. * subversion/libsvn_subr/version.c (svn_version_extended_t): Define here. Remove the version_number and version_string fields, they're redundant. (svn_version_extended) remove initialization for version_number and version_string. (svn_version_ext_build_date, svn_version_ext_build_time, svn_version_ext_build_host, svn_version_ext_copyright, svn_version_ext_runtime_host, svn_version_ext_runtime_osname, svn_version_ext_linked_libs, svn_version_ext_loaded_libs): Implement. * subversion/libsvn_subr/opt.c (svn_opt__print_version_info): Use the new svn_version_ext_* accessors to retreive extended version information. Use SVN_VER_NUMBER and SVN_VERSION since these fields are no longer part of the extended version info. * subversion/libsvn_subr/sysinfo.c: Propagate renames of svn_version_ext_linked_lib_t and svn_version_ext_loaded_lib_t. Modified: subversion/trunk/subversion/include/svn_version.h subversion/trunk/subversion/libsvn_subr/opt.c subversion/trunk/subversion/libsvn_subr/sysinfo.c subversion/trunk/subversion/libsvn_subr/version.c Modified: subversion/trunk/subversion/include/svn_version.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_version.h?rev=1383149&r1=1383148&r2=1383149&view=diff ============================================================================== --- subversion/trunk/subversion/include/svn_version.h (original) +++ subversion/trunk/subversion/include/svn_version.h Mon Sep 10 23:21:28 2012 @@ -262,30 +262,92 @@ svn_subr_version(void); * * @since New in 1.8. */ -typedef struct svn_version_extended_t -{ - const char *version_number; /**< Version number */ - const char *version_string; /**< Version string */ - const char *build_date; /**< Compilation date */ - const char *build_time; /**< Compilation time */ - const char *build_host; /**< Build canonical host name */ - const char *copyright; /**< Copyright notice (localized) */ - const char *runtime_host; /**< Runtime canonical host name */ - const char *runtime_osname; /**< Running OS release name */ - - /** - * Array of svn_version_linked_lib_t describing dependent libraries. - */ - const apr_array_header_t *linked_libs; - - /** - * Array of svn_version_loaded_lib_t describing loaded shared libraries. - * - * On Mac OS X, the loaded frameworks, private frameworks and - * system libraries will not be listed here. - */ - const apr_array_header_t *loaded_libs; -} svn_version_extended_t; +typedef struct svn_version_extended_t svn_version_extended_t; + +/** + * Return version information for the running program. If @a verbose + * is true, collect extra information that may be expensive to + * retrieve (for example, the OS release name, list of shared + * libraries, etc.). Use @a pool for all allocations. + * + * @since New in 1.8. + */ +const svn_version_extended_t * +svn_version_extended(svn_boolean_t verbose, + apr_pool_t *pool); + + +/** + * Accessor for svn_version_extended_t. + * + * @return The date when the libsvn_subr library was compiled, in the + * format defined by the C standard macro @c __DATE__. + * + * @since New in 1.8. + */ +const char * +svn_version_ext_build_date(const svn_version_extended_t *ext_info); + +/** + * Accessor for svn_version_extended_t. + * + * @return The time when the libsvn_subr library was compiled, in the + * format defined by the C standard macro @c __TIME__. + * + * @since New in 1.8. + */ +const char * +svn_version_ext_build_time(const svn_version_extended_t *ext_info); + +/** + * Accessor for svn_version_extended_t. + * + * @return The canonical host triplet (arch-vendor-osname) of the + * system where libsvn_subr was compiled. + * + * @note On Unix-like systems (includng Mac OS X), this string is the + * same as the output of the config.guess script. + * + * @since New in 1.8. + */ +const char * +svn_version_ext_build_host(const svn_version_extended_t *ext_info); + +/** + * Accessor for svn_version_extended_t. + * + * @return The localized copyright notice. + * + * @since New in 1.8. + */ +const char * +svn_version_ext_copyright(const svn_version_extended_t *ext_info); + +/** + * Accessor for svn_version_extended_t. + * + * @return The canonical host triplet (arch-vendor-osname) of the + * system where the current process is running. + * + * @note This string may not be the same as the output of config.guess + * on the same system. + * + * @since New in 1.8. + */ +const char * +svn_version_ext_runtime_host(const svn_version_extended_t *ext_info); + +/** + * Accessor for svn_version_extended_t. + * + * @return The "commercial" release name of the running operating + * system, if available. Not to be confused with, e.g., the output of + * "uname -v" or "uname -r". The returned value may be @c NULL. + * + * @since New in 1.8. + */ +const char * +svn_version_ext_runtime_osname(const svn_version_extended_t *ext_info); /** * Dependent library information. @@ -294,12 +356,24 @@ typedef struct svn_version_extended_t * * @since New in 1.8. */ -typedef struct svn_version_linked_lib_t +typedef struct svn_version_ext_linked_lib_t { const char *name; /**< Library name */ const char *compiled_version; /**< Compile-time version string */ const char *runtime_version; /**< Run-time version string (optional) */ -} svn_version_linked_lib_t; +} svn_version_ext_linked_lib_t; + +/** + * Accessor for svn_version_extended_t. + * + * @eturns Array of svn_version_ext_linked_lib_t describing dependent + * libraries. The returned value may be @c NULL. + * + * @since New in 1.8. + */ +const apr_array_header_t * +svn_version_ext_linked_libs(const svn_version_extended_t *ext_info); + /** * Loaded shared library information. @@ -308,22 +382,26 @@ typedef struct svn_version_linked_lib_t * * @since New in 1.8. */ -typedef struct svn_version_loaded_lib_t +typedef struct svn_version_ext_loaded_lib_t { const char *name; /**< Library name */ const char *version; /**< Library version (optional) */ -} svn_version_loaded_lib_t; +} svn_version_ext_loaded_lib_t; + /** - * Return version information for the running program, If @a verbose - * is true, collect extra information about the runtime system (this - * can be an expensive operation). Use @a pool for all allocations. + * Accessor for svn_version_extended_t. + * + * @return Array of svn_version_ext_loaded_lib_t describing loaded + * shared libraries. The returned value may be @c NULL. + * + * @note On Mac OS X, the loaded frameworks, private frameworks and + * system libraries will not be listed. * * @since New in 1.8. */ -const svn_version_extended_t * -svn_version_extended(svn_boolean_t verbose, - apr_pool_t *pool); +const apr_array_header_t * +svn_version_ext_loaded_libs(const svn_version_extended_t *ext_info); #ifdef __cplusplus Modified: subversion/trunk/subversion/libsvn_subr/opt.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/opt.c?rev=1383149&r1=1383148&r2=1383149&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/opt.c (original) +++ subversion/trunk/subversion/libsvn_subr/opt.c Mon Sep 10 23:21:28 2012 @@ -1111,14 +1111,15 @@ svn_opt__print_version_info(const char * apr_pool_t *pool) { if (quiet) - return svn_cmdline_printf(pool, "%s\n", info->version_number); + return svn_cmdline_printf(pool, "%s\n", SVN_VER_NUMBER); SVN_ERR(svn_cmdline_printf(pool, _("%s, version %s\n" " compiled %s, %s on %s\n\n"), - pgm_name, info->version_string, - info->build_date, info->build_time, - info->build_host)); - SVN_ERR(svn_cmdline_printf(pool, "%s\n", info->copyright)); + pgm_name, SVN_VERSION, + svn_version_ext_build_date(info), + svn_version_ext_build_time(info), + svn_version_ext_build_host(info))); + SVN_ERR(svn_cmdline_printf(pool, "%s\n", svn_version_ext_copyright(info))); if (footer) { @@ -1127,26 +1128,28 @@ svn_opt__print_version_info(const char * if (verbose) { + const apr_array_header_t *libs; + SVN_ERR(svn_cmdline_fputs(_("System information:\n\n"), stdout, pool)); SVN_ERR(svn_cmdline_printf(pool, _("* running on %s\n"), - info->runtime_host)); - if (info->runtime_osname) + svn_version_ext_runtime_host(info))); + if (svn_version_ext_runtime_osname(info)) { SVN_ERR(svn_cmdline_printf(pool, _(" - %s\n"), - info->runtime_osname)); + svn_version_ext_runtime_osname(info))); } - if (info->linked_libs && info->linked_libs->nelts) + libs = svn_version_ext_linked_libs(info); + if (libs && libs->nelts) { - const svn_version_linked_lib_t *lib; + const svn_version_ext_linked_lib_t *lib; int i; SVN_ERR(svn_cmdline_fputs(_("* linked dependencies:\n"), stdout, pool)); - for (i = 0; i < info->linked_libs->nelts; ++i) + for (i = 0; i < libs->nelts; ++i) { - lib = &APR_ARRAY_IDX(info->linked_libs, i, - svn_version_linked_lib_t); + lib = &APR_ARRAY_IDX(libs, i, svn_version_ext_linked_lib_t); if (lib->runtime_version) SVN_ERR(svn_cmdline_printf(pool, " - %s %s (compiled with %s)\n", @@ -1161,17 +1164,17 @@ svn_opt__print_version_info(const char * } } - if (info->loaded_libs && info->loaded_libs->nelts) + libs = svn_version_ext_loaded_libs(info); + if (libs && libs->nelts) { - const svn_version_loaded_lib_t *lib; + const svn_version_ext_loaded_lib_t *lib; int i; SVN_ERR(svn_cmdline_fputs(_("* loaded shared libraries:\n"), stdout, pool)); - for (i = 0; i < info->loaded_libs->nelts; ++i) + for (i = 0; i < libs->nelts; ++i) { - lib = &APR_ARRAY_IDX(info->loaded_libs, i, - svn_version_loaded_lib_t); + lib = &APR_ARRAY_IDX(libs, i, svn_version_ext_loaded_lib_t); if (lib->version) SVN_ERR(svn_cmdline_printf(pool, " - %s (%s)\n", Modified: subversion/trunk/subversion/libsvn_subr/sysinfo.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sysinfo.c?rev=1383149&r1=1383148&r2=1383149&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/sysinfo.c (original) +++ subversion/trunk/subversion/libsvn_subr/sysinfo.c Mon Sep 10 23:21:28 2012 @@ -125,20 +125,20 @@ svn_sysinfo__release_name(apr_pool_t *po const apr_array_header_t * svn_sysinfo__linked_libs(apr_pool_t *pool) { - svn_version_linked_lib_t *lib; + svn_version_ext_linked_lib_t *lib; apr_array_header_t *array = apr_array_make(pool, 3, sizeof(*lib)); - lib = &APR_ARRAY_PUSH(array, svn_version_linked_lib_t); + lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t); lib->name = "APR"; lib->compiled_version = APR_VERSION_STRING; lib->runtime_version = apr_pstrdup(pool, apr_version_string()); - lib = &APR_ARRAY_PUSH(array, svn_version_linked_lib_t); + lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t); lib->name = "APR-Util"; lib->compiled_version = APU_VERSION_STRING; lib->runtime_version = apr_pstrdup(pool, apu_version_string()); - lib = &APR_ARRAY_PUSH(array, svn_version_linked_lib_t); + lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t); lib->name = "SQLite"; lib->compiled_version = apr_pstrdup(pool, svn_sqlite__compiled_version()); #ifdef SVN_SQLITE_INLINE @@ -830,7 +830,7 @@ win32_shared_libs(apr_pool_t *pool) filename = wcs_to_utf8(buffer, pool); if (filename) { - svn_version_loaded_lib_t *lib; + svn_version_ext_loaded_lib_t *lib; char *truename; if (0 == apr_filepath_merge(&truename, "", filename, @@ -843,7 +843,7 @@ win32_shared_libs(apr_pool_t *pool) { array = apr_array_make(pool, 32, sizeof(*lib)); } - lib = &APR_ARRAY_PUSH(array, svn_version_loaded_lib_t); + lib = &APR_ARRAY_PUSH(array, svn_version_ext_loaded_lib_t); lib->name = filename; lib->version = version; } @@ -1063,7 +1063,7 @@ macos_shared_libs(apr_pool_t *pool) const char *filename = _dyld_get_image_name(i); const char *version; char *truename; - svn_version_loaded_lib_t *lib; + svn_version_ext_loaded_lib_t *lib; if (!(header && filename)) break; @@ -1101,7 +1101,7 @@ macos_shared_libs(apr_pool_t *pool) { result = apr_array_make(pool, 32, sizeof(*lib)); } - lib = &APR_ARRAY_PUSH(result, svn_version_loaded_lib_t); + lib = &APR_ARRAY_PUSH(result, svn_version_ext_loaded_lib_t); } else { @@ -1109,7 +1109,7 @@ macos_shared_libs(apr_pool_t *pool) { dylibs = apr_array_make(pool, 32, sizeof(*lib)); } - lib = &APR_ARRAY_PUSH(dylibs, svn_version_loaded_lib_t); + lib = &APR_ARRAY_PUSH(dylibs, svn_version_ext_loaded_lib_t); } lib->name = filename; Modified: subversion/trunk/subversion/libsvn_subr/version.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/version.c?rev=1383149&r1=1383148&r2=1383149&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/version.c (original) +++ subversion/trunk/subversion/libsvn_subr/version.c Mon Sep 10 23:21:28 2012 @@ -99,14 +99,31 @@ svn_ver_check_list(const svn_version_t * } +struct svn_version_extended_t +{ + const char *build_date; /* Compilation date */ + const char *build_time; /* Compilation time */ + const char *build_host; /* Build canonical host name */ + const char *copyright; /* Copyright notice (localized) */ + const char *runtime_host; /* Runtime canonical host name */ + const char *runtime_osname; /* Running OS release name */ + + /* Array of svn_version_ext_linked_lib_t describing dependent + libraries. */ + const apr_array_header_t *linked_libs; + + /* Array of svn_version_ext_loaded_lib_t describing loaded shared + libraries. */ + const apr_array_header_t *loaded_libs; +}; + + const svn_version_extended_t * svn_version_extended(svn_boolean_t verbose, apr_pool_t *pool) { svn_version_extended_t *info = apr_pcalloc(pool, sizeof(*info)); - info->version_number = SVN_VER_NUMBER; - info->version_string = SVN_VERSION; info->build_date = __DATE__; info->build_time = __TIME__; info->build_host = SVN_BUILD_HOST; @@ -127,3 +144,52 @@ svn_version_extended(svn_boolean_t verbo return info; } + + +const char * +svn_version_ext_build_date(const svn_version_extended_t *ext_info) +{ + return ext_info->build_date; +} + +const char * +svn_version_ext_build_time(const svn_version_extended_t *ext_info) +{ + return ext_info->build_time; +} + +const char * +svn_version_ext_build_host(const svn_version_extended_t *ext_info) +{ + return ext_info->build_host; +} + +const char * +svn_version_ext_copyright(const svn_version_extended_t *ext_info) +{ + return ext_info->copyright; +} + +const char * +svn_version_ext_runtime_host(const svn_version_extended_t *ext_info) +{ + return ext_info->runtime_host; +} + +const char * +svn_version_ext_runtime_osname(const svn_version_extended_t *ext_info) +{ + return ext_info->runtime_osname; +} + +const apr_array_header_t * +svn_version_ext_linked_libs(const svn_version_extended_t *ext_info) +{ + return ext_info->linked_libs; +} + +const apr_array_header_t * +svn_version_ext_loaded_libs(const svn_version_extended_t *ext_info) +{ + return ext_info->loaded_libs; +}