get_image_symbol() and get_nth_image_symbol() now accept NULL arguments for the

location and type parameters.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19010 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-10-06 12:17:06 +00:00
parent 0d7ec13a82
commit e979f4bac7

View File

@ -1367,15 +1367,18 @@ get_nth_symbol(image_id imageID, int32 num, char *nameBuffer, int32 *_nameLength
strlcpy(nameBuffer, SYMNAME(image, symbol), *_nameLength);
*_nameLength = strlen(SYMNAME(image, symbol));
// ToDo: check with the return types of that BeOS function
if (ELF32_ST_TYPE(symbol->st_info) == STT_FUNC)
*_type = B_SYMBOL_TYPE_TEXT;
else if (ELF32_ST_TYPE(symbol->st_info) == STT_OBJECT)
*_type = B_SYMBOL_TYPE_DATA;
else
*_type = B_SYMBOL_TYPE_ANY;
if (_type != NULL) {
// ToDo: check with the return types of that BeOS function
if (ELF32_ST_TYPE(symbol->st_info) == STT_FUNC)
*_type = B_SYMBOL_TYPE_TEXT;
else if (ELF32_ST_TYPE(symbol->st_info) == STT_OBJECT)
*_type = B_SYMBOL_TYPE_DATA;
else
*_type = B_SYMBOL_TYPE_ANY;
}
*_location = (void *)(symbol->st_value + image->regions[0].delta);
if (_location != NULL)
*_location = (void *)(symbol->st_value + image->regions[0].delta);
goto out;
}
count++;
@ -1407,9 +1410,10 @@ get_symbol(image_id imageID, char const *symbolName, int32 symbolType, void **_l
// get the symbol in the image
symbol = find_symbol(image, symbolName, symbolType);
if (symbol)
*_location = (void *)(symbol->st_value + image->regions[0].delta);
else
if (symbol) {
if (_location != NULL)
*_location = (void *)(symbol->st_value + image->regions[0].delta);
} else
status = B_ENTRY_NOT_FOUND;
} else
status = B_BAD_IMAGE_ID;