Add CopyOf utility method
Add a utility method that returns a copy of a slice of strings.
This is primarily useful when appending to a string slice to avoid
accidentally reusing the backing array.
Test: util_test.go
Change-Id: I7801fc7ca19e27ddc9f1b1b452788b723c7f619c
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index eacb86a..7fdfb49 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -578,9 +578,7 @@
}
}
-func copyOf(l []string) []string {
- return append([]string(nil), l...)
-}
+var copyOf = android.CopyOf
func anyHavePrefix(l []string, prefix string) bool {
for _, x := range l {