From 88df8322a9670721743a057e6bb008365ae21f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 26 Jan 2007 12:05:10 +0000 Subject: [PATCH] Optimized current_team() - it now uses a static variable to hold the team ID. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19964 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/AppMisc.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/kits/app/AppMisc.cpp b/src/kits/app/AppMisc.cpp index c71d0c8326..bb240efa9f 100644 --- a/src/kits/app/AppMisc.cpp +++ b/src/kits/app/AppMisc.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2005, Haiku. + * Copyright 2001-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -7,14 +7,14 @@ */ -#include -#include - #include #include #include #include +#include +#include + namespace BPrivate { @@ -117,10 +117,12 @@ get_app_ref(entry_ref *ref, bool traverse) team_id current_team() { - team_id team = -1; - thread_info info; - if (get_thread_info(find_thread(NULL), &info) == B_OK) - team = info.team; + static team_id team = -1; + if (team < 0) { + thread_info info; + if (get_thread_info(find_thread(NULL), &info) == B_OK) + team = info.team; + } return team; }