Commit graph

6 commits

Author SHA1 Message Date
Dan Willemsen
d6989f2e52 Fix usage of bytes.NewBuffer in bpfix
According to the documentation: "NewBuffer creates and initializes a new
Buffer using buf as its initial contents. The new Buffer takes ownership
of buf, and the caller should not use buf after this call."

Test: Run bpfix twice, only wrote the first time.
Change-Id: I52f88bfd9247240436b46f396c9196157774615b
2018-05-07 16:22:22 -07:00
Colin Cross
adee968a4b Make bpfix not modify the input tree
Make a new object called Fixer to hold the state of the tree, and
make a copy of the input tree so the original doesn't get modified.

Test: bpfix_test.go
Change-Id: I1dc6fd99158c8b0e1db029df99e6cf72699a5e63
2018-04-16 17:32:08 +00:00
Colin Cross
3fad895e75 Don't pretend *parser.List is immutable
The functions in bpfix that take a *parser.List and return a
modified *parser.List are always returning the same pointer
and mutating the target of the pointer.  Remove the extra
unnecessary return value.

Also extract the getLiteralListProperty function.

Test: androidmk_test.go
Change-Id: I08d8aff955c72b7916741cda8083974a49af4d6f
2018-02-22 14:54:47 -08:00
Jeff Gaston
aff66e55a9 Revert "Revert "Initial implementation of bpfix""
Bug: 38351765
Test: bpfix Android.bp

This reverts commit a8cc9c53fa.

Change-Id: I60f02a8dd920346aa17b9044f834ffe94fa693c6
2017-06-19 15:52:15 -07:00
Jeff Gaston
a8cc9c53fa Revert "Initial implementation of bpfix"
This reverts commit de4b0463f2.

Reason for revert: postsubmit build broken

Change-Id: If68a4af22e517b7be0876343a81c1319fa4d7046
2017-05-26 00:29:26 +00:00
Jeff Gaston
de4b0463f2 Initial implementation of bpfix
Bug: 38351765
Test: bpfix Android.bp

Change-Id: Ia94602f93bc40db3d006174c39102ac5fd29a64c
2017-05-24 13:06:35 -07:00