mkiiskila closed pull request #99: size; map file parsing was not handling 
plain .o file names coming
URL: https://github.com/apache/mynewt-newt/pull/99
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/newt/builder/size.go b/newt/builder/size.go
index 7cdcc45..b00feb7 100644
--- a/newt/builder/size.go
+++ b/newt/builder/size.go
@@ -224,6 +224,7 @@ func ParseMapFileSizes(fileName string) 
(map[string]*PkgSize, error) {
                        }
 
                        array := strings.Fields(scanner.Text())
+
                        switch len(array) {
                        case 1:
                                /*
@@ -308,12 +309,18 @@ func ParseMapFileSizes(fileName string) 
(map[string]*PkgSize, error) {
                        if size == 0 {
                                continue
                        }
+
+                       // srcFile might be : mylib.a(object_file.o) or 
object_file.o
                        tmpStrArr := strings.Split(srcFile, "(")
                        srcLib := tmpStrArr[0]
                        objName := ""
                        if srcLib != "*fill*" {
-                               tmpStrArr = strings.Split(tmpStrArr[1], ")")
-                               objName = tmpStrArr[0]
+                               if len(tmpStrArr) > 1 {
+                                       tmpStrArr = strings.Split(tmpStrArr[1], 
")")
+                                       objName = tmpStrArr[0]
+                               } else {
+                                       objName = filepath.Base(tmpStrArr[0])
+                               }
                        }
                        tmpStrArr = strings.Split(symName, ".")
                        if len(tmpStrArr) > 2 {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to