Revert "Speed up vendor snapshot header globs"

This reverts commit 0f93e5b9fb969ca184e755b6e44a59a67cd65480.

Reason for revert: causing extra soong regenerations

Change-Id: I4ed2e5c82dfe3e99fbb9590b80f92c79a27e8025
diff --git a/cc/library.go b/cc/library.go
index 73ed969..af9aaca 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -449,37 +449,23 @@
 			}
 			continue
 		}
-		glob, err := ctx.GlobWithDeps(dir+"/**/*", nil)
-		if err != nil {
-			ctx.ModuleErrorf("glob failed: %#v", err)
-			return
+		exts := headerExts
+		// Glob all files under this special directory, because of C++ headers.
+		if strings.HasPrefix(dir, "external/libcxx/include") {
+			exts = []string{""}
 		}
-		isLibcxx := strings.HasPrefix(dir, "external/libcxx/include")
-		j := 0
-		for i, header := range glob {
-			if isLibcxx {
-				// Glob all files under this special directory, because of C++ headers with no
-				// extension.
-				if !strings.HasSuffix(header, "/") {
+		for _, ext := range exts {
+			glob, err := ctx.GlobWithDeps(dir+"/**/*"+ext, nil)
+			if err != nil {
+				ctx.ModuleErrorf("glob failed: %#v", err)
+				return
+			}
+			for _, header := range glob {
+				if strings.HasSuffix(header, "/") {
 					continue
 				}
-			} else {
-				// Filter out only the files with extensions that are headers.
-				found := false
-				for _, ext := range headerExts {
-					if strings.HasSuffix(header, ext) {
-						found = true
-						break
-					}
-				}
-				if !found {
-					continue
-				}
+				ret = append(ret, android.PathForSource(ctx, header))
 			}
-			if i != j {
-				glob[j] = glob[i]
-			}
-			j++
 		}
 	}