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
+15 -11
View File
@@ -1367,15 +1367,18 @@ 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));
// ToDo: check with the return types of that BeOS function if (_type != NULL) {
if (ELF32_ST_TYPE(symbol->st_info) == STT_FUNC) // ToDo: check with the return types of that BeOS function
*_type = B_SYMBOL_TYPE_TEXT; if (ELF32_ST_TYPE(symbol->st_info) == STT_FUNC)
else if (ELF32_ST_TYPE(symbol->st_info) == STT_OBJECT) *_type = B_SYMBOL_TYPE_TEXT;
*_type = B_SYMBOL_TYPE_DATA; else if (ELF32_ST_TYPE(symbol->st_info) == STT_OBJECT)
else *_type = B_SYMBOL_TYPE_DATA;
*_type = B_SYMBOL_TYPE_ANY; 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; goto out;
} }
count++; count++;
@@ -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) {
*_location = (void *)(symbol->st_value + image->regions[0].delta); if (_location != NULL)
else *_location = (void *)(symbol->st_value + image->regions[0].delta);
} else
status = B_ENTRY_NOT_FOUND; status = B_ENTRY_NOT_FOUND;
} else } else
status = B_BAD_IMAGE_ID; status = B_BAD_IMAGE_ID;