Merge "external/libvpx: cherry-pick -Wunreachable-code-loop-increment fix" into stage-aosp-master
diff --git a/README.version b/README.version
index dfc6a89..b16d019 100644
--- a/README.version
+++ b/README.version
@@ -8,3 +8,4 @@
       (11de1b838 Fix timestamp overflow issues)
     * https://chromium-review.googlesource.com/q/I1d8a6e263fddb9e4cc6265a313011a18d18bbf9e
       (04383393e Add missing typecast and re-enable timestamp test)
+    * 223645aa8 vpx_codec_enc_config_default: rm unnecessary loop
diff --git a/libvpx/configure b/libvpx/configure
index 6204f10..ee46bb1 100755
--- a/libvpx/configure
+++ b/libvpx/configure
@@ -613,6 +613,7 @@
         check_add_cflags -Wvla
         check_add_cflags -Wimplicit-function-declaration
         check_add_cflags -Wuninitialized
+        check_add_cflags -Wunreachable-code-loop-increment
         check_add_cflags -Wunused
         check_add_cflags -Wextra
         # check_add_cflags also adds to cxxflags. gtest does not do well with
diff --git a/libvpx/vpx/src/vpx_encoder.c b/libvpx/vpx/src/vpx_encoder.c
index ac1e3d0..76140b7 100644
--- a/libvpx/vpx/src/vpx_encoder.c
+++ b/libvpx/vpx/src/vpx_encoder.c
@@ -151,22 +151,15 @@
                                              vpx_codec_enc_cfg_t *cfg,
                                              unsigned int usage) {
   vpx_codec_err_t res;
-  vpx_codec_enc_cfg_map_t *map;
-  int i;
 
   if (!iface || !cfg || usage != 0)
     res = VPX_CODEC_INVALID_PARAM;
   else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
     res = VPX_CODEC_INCAPABLE;
   else {
-    res = VPX_CODEC_INVALID_PARAM;
-
-    for (i = 0; i < iface->enc.cfg_map_count; ++i) {
-      map = iface->enc.cfg_maps + i;
-      *cfg = map->cfg;
-      res = VPX_CODEC_OK;
-      break;
-    }
+    assert(iface->enc.cfg_map_count == 1);
+    *cfg = iface->enc.cfg_maps->cfg;
+    res = VPX_CODEC_OK;
   }
 
   return res;