Assorted whitespace cleanup and typo fixes.
[haiku.git] / src / kits / network / libnetapi / init.cpp
blobc311573fdd41f46d00e2260fbed0ce440a7dba68
1 /*
2 * Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Axel Dörfler, axeld@pinc-software.de
7 */
9 #include <string.h>
11 #include <image.h>
12 #include <OS.h>
14 #include <r5_compatibility.h>
17 static void
18 find_own_image()
20 int32 cookie = 0;
21 image_info info;
22 while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
23 if (((addr_t)info.text <= (addr_t)find_own_image
24 && (addr_t)info.text + (size_t)info.text_size > (addr_t)find_own_image)) {
25 // found us
26 __gNetAPIStart = (addr_t)min_c(info.text, info.data);
27 __gNetAPIEnd = min_c((addr_t)info.text + info.text_size,
28 (addr_t)info.data + info.data_size);
29 break;
35 extern "C" void
36 initialize_before()
38 // If in compatibility mode get our code address range.
39 if (__gR5Compatibility)
40 find_own_image();