mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-20 05:36:23 +02:00
util/nvmutil: tidy up rhex
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -340,9 +340,14 @@ hextonum(char ch)
|
|||||||
static uint8_t
|
static uint8_t
|
||||||
rhex(void)
|
rhex(void)
|
||||||
{
|
{
|
||||||
static uint8_t n = 0, rnum[12];
|
static uint8_t n = 0;
|
||||||
if (!n)
|
static uint8_t rnum[12];
|
||||||
err_if(read(rfd, (uint8_t *) &rnum, (n = 11) + 1) == -1);
|
|
||||||
|
if (!n) {
|
||||||
|
n = sizeof(rnum) - 1;
|
||||||
|
err_if(read(rfd, (uint8_t *) &rnum, n + 1) == -1);
|
||||||
|
}
|
||||||
|
|
||||||
return rnum[n--] & 0xf;
|
return rnum[n--] & 0xf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user