From b6d2a40a3efc6ea444f2570afbf81a9fd0450bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Mon, 18 Jun 2012 23:12:33 +0000 Subject: [PATCH] Refactored the Boost Build execnt.c module's maxline() function to cache its result instead of calling the GetVersionEx() Windows API on every call. [SVN r78989] --- v2/engine/execnt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/v2/engine/execnt.c b/v2/engine/execnt.c index 02294c6f9..6e255f5b0 100644 --- a/v2/engine/execnt.c +++ b/v2/engine/execnt.c @@ -599,7 +599,7 @@ static void free_argv( char const * * args ) * http://support.microsoft.com/default.aspx?scid=kb;en-us;830473 */ -int maxline() +static int raw_maxline() { OSVERSIONINFO os_info; os_info.dwOSVersionInfoSize = sizeof( os_info ); @@ -610,6 +610,13 @@ int maxline() return 996; /* NT 3.5.1 */ } +int maxline() +{ + static result; + if ( !result ) result = raw_maxline(); + return result; +} + /* * Convert a command string into arguments as used by Unix spawnvp() API. The