From 7eec769550d6c548a3a80c3413c93e4abdc479cd Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Mon, 1 Sep 2014 09:53:35 +1000 Subject: Clean up the obj parse patch. --- rtl-obj.c | 2 +- rtl-obj.h | 2 +- rtl.c | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/rtl-obj.c b/rtl-obj.c index 532756a..15de926 100644 --- a/rtl-obj.c +++ b/rtl-obj.c @@ -119,7 +119,7 @@ bool rtems_rtl_parse_name (const char* name, const char** aname, const char** oname, - int* ooffset) + off_t* ooffset) { const char* laname = NULL; const char* loname = NULL; diff --git a/rtl-obj.h b/rtl-obj.h index 7e200d6..cc6d832 100644 --- a/rtl-obj.h +++ b/rtl-obj.h @@ -294,7 +294,7 @@ bool rtems_rtl_obj_unresolved (rtems_rtl_obj_t* obj); bool rtems_rtl_parse_name (const char* name, const char** aname, const char** oname, - int* ooffset); + off_t* ooffset); /** * Load the object file. diff --git a/rtl.c b/rtl.c index 3e96742..4b92992 100644 --- a/rtl.c +++ b/rtl.c @@ -378,7 +378,7 @@ rtems_rtl_find_obj (const char* name) rtems_rtl_obj_t* found = NULL; const char* aname = NULL; const char* oname = NULL; - int ooffset; + off_t ooffset; if (!rtems_rtl_parse_name (name, &aname, &oname, &ooffset)) return NULL; @@ -388,12 +388,23 @@ rtems_rtl_find_obj (const char* name) while (!rtems_chain_is_tail (&rtl->objects, node)) { rtems_rtl_obj_t* obj = (rtems_rtl_obj_t*) node; - if (rtems_rtl_match_name (obj, name)) - return obj; + if ((aname == NULL && strcmp (obj->oname, oname) == 0) || + (aname != NULL && + strcmp (obj->aname, aname) == 0 && strcmp (obj->oname, oname) == 0)) + { + found = obj; + break; + } node = rtems_chain_next (node); } - return NULL; + if (!aname) + rtems_rtl_alloc_del(RTEMS_RTL_ALLOC_OBJECT, (void*) aname); + + if (!oname) + rtems_rtl_alloc_del(RTEMS_RTL_ALLOC_OBJECT, (void*) oname); + + return found; } rtems_rtl_obj_t* -- cgit v1.2.3