aboutsummaryrefslogtreecommitdiffstats
path: root/context.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-01-23 13:23:00 -0800
committerColin Cross <ccross@android.com>2019-01-23 13:26:42 -0800
commitde7afaaf749957b3b7c03036e36c99a5ac7e3afb (patch)
tree252b6d360e85ef51166c3d7ac3ee090f887a02d0 /context.go
parent3a8c0256480255efdebd738238084cc9d6bf2b54 (diff)
downloadandroid_build_blueprint-de7afaaf749957b3b7c03036e36c99a5ac7e3afb.tar.gz
android_build_blueprint-de7afaaf749957b3b7c03036e36c99a5ac7e3afb.tar.bz2
android_build_blueprint-de7afaaf749957b3b7c03036e36c99a5ac7e3afb.zip
Write ninja file directly to the output file
Writing the ninja file to a byte buffer causes a significant amount of time to be spent in memmove when growing the byte slice. Write the file directly to disk instead. This also fixes some unhandled error warnings, which become more likely when doing disk IO instead of byte buffer writes. Change-Id: I5094e4c45cab4012713037f60c5a4fb00718f92e
Diffstat (limited to 'context.go')
-rw-r--r--context.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/context.go b/context.go
index 8d44853..5694ac0 100644
--- a/context.go
+++ b/context.go
@@ -3113,7 +3113,10 @@ func (c *Context) writeNinjaRequiredVersion(nw *ninjaWriter) error {
func (c *Context) writeSubninjas(nw *ninjaWriter) error {
for _, subninja := range c.subninjas {
- nw.Subninja(subninja)
+ err := nw.Subninja(subninja)
+ if err != nil {
+ return err
+ }
}
return nw.BlankLine()
}