Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/70892 )
Change subject: layout: layout_next_included_region() return a region not romentry ......................................................................
layout: layout_next_included_region() return a region not romentry
Do exactly what it says on the tin, no need to return they wrapping ADT structure, just return the found data within the ADT.
Change-Id: Ibeab87c87b9da3112e1866bc058e0f85bacddc7a Signed-off-by: Edward O'Callaghan quasisec@google.com --- M flashrom.c M include/layout.h M layout.c 3 files changed, 19 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/92/70892/1
diff --git a/flashrom.c b/flashrom.c index e271614..2fb532e 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1806,11 +1806,10 @@ uint8_t *const newcontents, const uint8_t *const oldcontents) { const struct flashrom_layout *const layout = get_layout(flashctx); - const struct romentry *included; + const struct flash_region *region; chipoff_t start = 0;
- while ((included = layout_next_included_region(layout, start))) { - const struct flash_region *region = &included->region; + while ((region = layout_next_included_region(layout, start))) { if (region->start > start) { /* copy everything up to the start of this included region */ memcpy(newcontents + start, oldcontents + start, region->start - start); diff --git a/include/layout.h b/include/layout.h index 70d99cb..61ab9c2 100644 --- a/include/layout.h +++ b/include/layout.h @@ -66,7 +66,7 @@ int process_include_args(struct flashrom_layout *, const struct layout_include_args *); void cleanup_include_args(struct layout_include_args **);
-const struct romentry *layout_next_included_region(const struct flashrom_layout *, chipoff_t); +const struct flash_region *layout_next_included_region(const struct flashrom_layout *, chipoff_t); const struct romentry *layout_next_included(const struct flashrom_layout *, const struct romentry *); const struct romentry *layout_next(const struct flashrom_layout *, const struct romentry *); int included_regions_overlap(const struct flashrom_layout *); diff --git a/layout.c b/layout.c index 6af0e41..1206b59 100644 --- a/layout.c +++ b/layout.c @@ -357,7 +357,7 @@ } }
-const struct romentry *layout_next_included_region( +const struct flash_region *layout_next_included_region( const struct flashrom_layout *const l, const chipoff_t where) { const struct romentry *entry = NULL, *lowest = NULL; @@ -371,7 +371,7 @@ lowest = entry; }
- return lowest; + return &lowest->region; }
const struct romentry *layout_next_included(