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
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2007, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -7,14 +7,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
|
|
||||||
#include <AppMisc.h>
|
#include <AppMisc.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
@@ -117,10 +117,12 @@ get_app_ref(entry_ref *ref, bool traverse)
|
|||||||
team_id
|
team_id
|
||||||
current_team()
|
current_team()
|
||||||
{
|
{
|
||||||
team_id team = -1;
|
static team_id team = -1;
|
||||||
thread_info info;
|
if (team < 0) {
|
||||||
if (get_thread_info(find_thread(NULL), &info) == B_OK)
|
thread_info info;
|
||||||
team = info.team;
|
if (get_thread_info(find_thread(NULL), &info) == B_OK)
|
||||||
|
team = info.team;
|
||||||
|
}
|
||||||
return team;
|
return team;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user