flashrom.c: Extract write loop into new write_range()

erase_block() and write_block() use the same loop logic to decide what
parts of a range need to be written. Move that into a new function,
write_range().

Change-Id: I13637978c03419ef06fbf3d4e0640c4630c49964
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72549
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
1 file changed