]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/xbmdec.c
avcodec/xbmenc: Pre-compute variables once for parse_str_int()
[ffmpeg] / libavcodec / xbmdec.c
index 2ce70204cf46d9aade8ef3f61cabcb82e240a1f7..b783d5abe5ee8d827b1489d7864a0df146f53f39 100644 (file)
@@ -39,11 +39,14 @@ static int convert(uint8_t x)
 
 static int parse_str_int(const uint8_t *p, const uint8_t *end, const uint8_t *key)
 {
-    for(; p<end - strlen(key); p++) {
-        if (!memcmp(p, key, strlen(key)))
+    int keylen = strlen(key);
+    const uint8_t *e = end - keylen;
+
+    for(; p < e; p++) {
+        if (!memcmp(p, key, keylen))
             break;
     }
-    p += strlen(key);
+    p += keylen;
     if (p >= end)
         return INT_MIN;