| 239 | namespace BPrivate |
| 240 | { |
| 241 | |
| 242 | |
| 243 | instantiation_func |
| 244 | find_instantiation_func(const char* className, const char* signature, |
| 245 | image_id* id) |
| 246 | { |
| 247 | if (className == NULL) { |
| 248 | errno = B_BAD_VALUE; |
| 249 | return NULL; |
| 250 | } |
| 251 | |
| 252 | thread_info threadInfo; |
| 253 | status_t err = get_thread_info(find_thread(NULL), &threadInfo); |
| 254 | if (err != B_OK) { |
| 255 | errno = err; |
| 256 | return NULL; |
| 257 | } |
| 258 | |
| 259 | instantiation_func instantiationFunc = NULL; |
| 260 | image_info imageInfo; |
| 261 | |
| 262 | BString name = className; |
| 263 | for (int32 pass = 0; pass < 2; pass++) { |
| 264 | BString funcName; |
| 265 | build_function_name(name, funcName); |
| 266 | |
| 267 | // for each image_id in team_id |
| 268 | int32 cookie = 0; |
| 269 | while (instantiationFunc == NULL |
| 270 | && get_next_image_info(threadInfo.team, &cookie, &imageInfo) |
| 271 | == B_OK) { |
| 272 | instantiationFunc = find_function_in_image(funcName, imageInfo.id, |
| 273 | err); |
| 274 | } |
| 275 | if (instantiationFunc != NULL) { |
| 276 | // if requested, save the image id in |
| 277 | // which the function was found |
| 278 | if (id != NULL) |
| 279 | *id = imageInfo.id; |
| 280 | break; |
| 281 | } |
| 282 | |
| 283 | // Check if we have a private class, and add the BPrivate namespace |
| 284 | // (for backwards compatibility) |
| 285 | if (!add_private_namespace(name)) |
| 286 | break; |
| 287 | } |
| 288 | |
| 289 | if (instantiationFunc != NULL |
| 290 | && check_signature(signature, imageInfo) != B_OK) |
| 291 | return NULL; |
| 292 | |
| 293 | return instantiationFunc; |
| 294 | } |
| 295 | |
| 296 | |
| 297 | } |
| 298 | |
| 299 | |
717 | | if (className == NULL) { |
718 | | errno = B_BAD_VALUE; |
719 | | return NULL; |
720 | | } |
721 | | |
722 | | thread_info threadInfo; |
723 | | status_t err = get_thread_info(find_thread(NULL), &threadInfo); |
724 | | if (err != B_OK) { |
725 | | errno = err; |
726 | | return NULL; |
727 | | } |
728 | | |
729 | | instantiation_func instantiationFunc = NULL; |
730 | | image_info imageInfo; |
731 | | |
732 | | BString name = className; |
733 | | for (int32 pass = 0; pass < 2; pass++) { |
734 | | BString funcName; |
735 | | build_function_name(name, funcName); |
736 | | |
737 | | // for each image_id in team_id |
738 | | int32 cookie = 0; |
739 | | while (instantiationFunc == NULL |
740 | | && get_next_image_info(threadInfo.team, &cookie, &imageInfo) |
741 | | == B_OK) { |
742 | | instantiationFunc = find_function_in_image(funcName, imageInfo.id, |
743 | | err); |
744 | | } |
745 | | if (instantiationFunc != NULL) |
746 | | break; |
747 | | |
748 | | // Check if we have a private class, and add the BPrivate namespace |
749 | | // (for backwards compatibility) |
750 | | if (!add_private_namespace(name)) |
751 | | break; |
752 | | } |
753 | | |
754 | | if (instantiationFunc != NULL |
755 | | && check_signature(signature, imageInfo) != B_OK) |
756 | | return NULL; |
757 | | |
758 | | return instantiationFunc; |
| 778 | return BPrivate::find_instantiation_func(className, signature, NULL); |