diff mbox

[U-Boot,V2,1/2] test/py: fix off-by-one error in spawn matching code

Message ID 1454720683-9557-1-git-send-email-swarren@wwwdotorg.org
State Accepted
Commit d8926811fd8b0d48e3bc99627c95544013bd3a7b
Delegated to: Simon Glass
Headers show

Commit Message

Stephen Warren Feb. 6, 2016, 1:04 a.m. UTC
From: Stephen Warren <swarren@nvidia.com>

A regex match object's .end() value is already the index after the match,
not the index of the last character in the match, so there's no need to
add 1 to point past the match.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v2: New patch.
---
 test/py/u_boot_spawn.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass Feb. 6, 2016, 8:30 p.m. UTC | #1
On 5 February 2016 at 18:04, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> A regex match object's .end() value is already the index after the match,
> not the index of the last character in the match, so there's no need to
> add 1 to point past the match.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> v2: New patch.
> ---
>  test/py/u_boot_spawn.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
Simon Glass Feb. 6, 2016, 8:44 p.m. UTC | #2
On 6 February 2016 at 13:30, Simon Glass <sjg@chromium.org> wrote:
> On 5 February 2016 at 18:04, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> A regex match object's .end() value is already the index after the match,
>> not the index of the last character in the match, so there's no need to
>> add 1 to point past the match.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>> v2: New patch.
>> ---
>>  test/py/u_boot_spawn.py | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>
> Tested on sandbox:
> Tested-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox

Patch

diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
index 4b9e81af3efb..3d9cde5ee0d0 100644
--- a/test/py/u_boot_spawn.py
+++ b/test/py/u_boot_spawn.py
@@ -142,7 +142,7 @@  class Spawn(object):
                     earliest_pi = pi
                 if earliest_m:
                     pos = earliest_m.start()
-                    posafter = earliest_m.end() + 1
+                    posafter = earliest_m.end()
                     self.before = self.buf[:pos]
                     self.after = self.buf[pos:posafter]
                     self.buf = self.buf[posafter:]