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