network: Utilize image_id argument to initialize_before.
We don't need to search for our own image_id, we already have it now, so just use it.
This commit is contained in:
@@ -15,27 +15,21 @@
|
||||
|
||||
|
||||
static void
|
||||
find_own_image()
|
||||
find_own_image(image_id id)
|
||||
{
|
||||
int32 cookie = 0;
|
||||
image_info info;
|
||||
while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
|
||||
if (((addr_t)info.text <= (addr_t)find_own_image
|
||||
&& (addr_t)info.text + (size_t)info.text_size > (addr_t)find_own_image)) {
|
||||
// found us
|
||||
__gNetAPIStart = (addr_t)min_c(info.text, info.data);
|
||||
__gNetAPIEnd = min_c((addr_t)info.text + info.text_size,
|
||||
(addr_t)info.data + info.data_size);
|
||||
break;
|
||||
}
|
||||
if (get_image_info(id, &info) == B_OK) {
|
||||
__gNetAPIStart = (addr_t)min_c(info.text, info.data);
|
||||
__gNetAPIEnd = min_c((addr_t)info.text + info.text_size,
|
||||
(addr_t)info.data + info.data_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
initialize_before(image_id)
|
||||
initialize_before(image_id id)
|
||||
{
|
||||
// If in compatibility mode get our code address range.
|
||||
if (__gR5Compatibility)
|
||||
find_own_image();
|
||||
find_own_image(id);
|
||||
}
|
||||
|
||||
@@ -24,26 +24,19 @@ addr_t __gNetAPIEnd;
|
||||
|
||||
|
||||
static void
|
||||
find_own_image()
|
||||
find_own_image(image_id id)
|
||||
{
|
||||
int32 cookie = 0;
|
||||
image_info info;
|
||||
while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
|
||||
if (((addr_t)info.text <= (addr_t)find_own_image
|
||||
&& (addr_t)info.text + (addr_t)info.text_size
|
||||
> (addr_t)find_own_image)) {
|
||||
// found us
|
||||
__gNetworkStart = (addr_t)min_c(info.text, info.data);
|
||||
__gNetworkEnd = min_c((addr_t)info.text + info.text_size,
|
||||
(addr_t)info.data + info.data_size);
|
||||
break;
|
||||
}
|
||||
if (get_image_info(id, &info) == B_OK) {
|
||||
__gNetworkStart = (addr_t)min_c(info.text, info.data);
|
||||
__gNetworkEnd = min_c((addr_t)info.text + info.text_size,
|
||||
(addr_t)info.data + info.data_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
initialize_before(image_id)
|
||||
initialize_before(image_id our_image)
|
||||
{
|
||||
// determine if we have to run in BeOS compatibility mode
|
||||
|
||||
@@ -81,7 +74,7 @@ initialize_before(image_id)
|
||||
|
||||
if (enable > 0) {
|
||||
__gR5Compatibility = true;
|
||||
find_own_image();
|
||||
find_own_image(our_image);
|
||||
debug_printf("libnetwork.so running in R5 compatibility mode.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user