Bug 1081601: Stop copying arrays manually. r=rnewman
authorChris Kitching <chriskitching@linux.com>
Sun, 12 Oct 2014 02:26:13 +0100
changeset 234536 a7f7455aad1a6d0d4e10e94a2edcec67941b91e0
parent 234535 e811af3754be45b84846faf3a4076d82b3b5a9e3
child 234537 8bb3624363e59e43495001ed66f48b7f2fe17c69
push id611
push userraliiev@mozilla.com
push dateMon, 05 Jan 2015 23:23:16 +0000
treeherdermozilla-release@345cd3b9c445 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1081601
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1081601: Stop copying arrays manually. r=rnewman
mobile/android/base/ContactService.java
--- a/mobile/android/base/ContactService.java
+++ b/mobile/android/base/ContactService.java
@@ -242,19 +242,17 @@ public class ContactService implements G
             // If filter value is undefined, avoid all the logic below and just return
             // all available raw contact IDs
             if ("".equals(filterValue) || "".equals(filterOp)) {
                 long[] allRawContactIds = getAllRawContactIds();
 
                 // Truncate the raw contacts IDs array if necessary
                 if (filterLimit > 0 && allRawContactIds.length > filterLimit) {
                     long[] truncatedRawContactIds = new long[filterLimit];
-                    for (int i = 0; i < filterLimit; i++) {
-                        truncatedRawContactIds[i] = allRawContactIds[i];
-                    }
+                    System.arraycopy(allRawContactIds, 0, truncatedRawContactIds, 0, filterLimit);
                     return truncatedRawContactIds;
                 }
                 return allRawContactIds;
             }
 
             // "match" can only be used with the "tel" field
             if ("match".equals(filterOp)) {
                 for (int i = 0; i < filterBy.length(); i++) {