cbfstool: provide buffer_offset()
Instead of people open coding the offset field access within a struct buffer provide buffer_offset() so that the implementation can change if needed without high touch in the code base. Change-Id: I751c7145687a8529ab549d87e412b7f2d1fb90ed Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/13468 Tested-by: build bot (Jenkins) Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
This commit is contained in:
parent
0a97d7eeba
commit
2dd5f4cce6
|
@ -62,6 +62,11 @@ static inline size_t buffer_size(const struct buffer *b)
|
|||
return b->size;
|
||||
}
|
||||
|
||||
static inline size_t buffer_offset(const struct buffer *b)
|
||||
{
|
||||
return b->offset;
|
||||
}
|
||||
|
||||
/*
|
||||
* Shrink a buffer toward the beginning of its previous space.
|
||||
* Afterward, buffer_delete() remains the means of cleaning it up. */
|
||||
|
@ -125,7 +130,7 @@ static inline void *buffer_get_original_backing(const struct buffer *b)
|
|||
{
|
||||
if (!b)
|
||||
return NULL;
|
||||
return b->data - b->offset;
|
||||
return buffer_get(b) - buffer_offset(b);
|
||||
}
|
||||
|
||||
/* Creates an empty memory buffer with given size.
|
||||
|
|
Loading…
Reference in New Issue