make android.InList generic
Change-Id: Ic166216cb473371a5e34cd97a068ca35f5534740
This commit is contained in:
@@ -137,19 +137,17 @@ func SortedUniqueStringValues(m interface{}) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IndexList returns the index of the first occurrence of the given string in the list or -1
|
// IndexList returns the index of the first occurrence of the given string in the list or -1
|
||||||
func IndexList(s string, list []string) int {
|
func IndexList[T comparable](t T, list []T) int {
|
||||||
for i, l := range list {
|
for i, l := range list {
|
||||||
if l == s {
|
if l == t {
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
// InList checks if the string belongs to the list
|
func InList[T comparable](t T, list []T) bool {
|
||||||
func InList(s string, list []string) bool {
|
return IndexList(t, list) != -1
|
||||||
return IndexList(s, list) != -1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setFromList[T comparable](l []T) map[T]bool {
|
func setFromList[T comparable](l []T) map[T]bool {
|
||||||
|
@@ -261,5 +261,3 @@ func LibFuzzerRuntimeLibrary(t Toolchain) string {
|
|||||||
func LibFuzzerRuntimeInterceptors(t Toolchain) string {
|
func LibFuzzerRuntimeInterceptors(t Toolchain) string {
|
||||||
return LibclangRuntimeLibrary(t, "fuzzer_interceptors")
|
return LibclangRuntimeLibrary(t, "fuzzer_interceptors")
|
||||||
}
|
}
|
||||||
|
|
||||||
var inList = android.InList
|
|
||||||
|
@@ -28,8 +28,8 @@ func includeDirsToFlags(dirs android.Paths) string {
|
|||||||
return android.JoinWithPrefix(dirs.Strings(), "-I")
|
return android.JoinWithPrefix(dirs.Strings(), "-I")
|
||||||
}
|
}
|
||||||
|
|
||||||
var indexList = android.IndexList
|
var indexList = android.IndexList[string]
|
||||||
var inList = android.InList
|
var inList = android.InList[string]
|
||||||
var filterList = android.FilterList
|
var filterList = android.FilterList
|
||||||
var removeListFromList = android.RemoveListFromList
|
var removeListFromList = android.RemoveListFromList
|
||||||
var removeFromList = android.RemoveFromList
|
var removeFromList = android.RemoveFromList
|
||||||
|
@@ -2664,7 +2664,7 @@ func (ks *kytheExtractJavaSingleton) GenerateBuildActions(ctx android.SingletonC
|
|||||||
var Bool = proptools.Bool
|
var Bool = proptools.Bool
|
||||||
var BoolDefault = proptools.BoolDefault
|
var BoolDefault = proptools.BoolDefault
|
||||||
var String = proptools.String
|
var String = proptools.String
|
||||||
var inList = android.InList
|
var inList = android.InList[string]
|
||||||
|
|
||||||
// Add class loader context (CLC) of a given dependency to the current CLC.
|
// Add class loader context (CLC) of a given dependency to the current CLC.
|
||||||
func addCLCFromDep(ctx android.ModuleContext, depModule android.Module,
|
func addCLCFromDep(ctx android.ModuleContext, depModule android.Module,
|
||||||
|
Reference in New Issue
Block a user