util/nvmutil: make err_if a function, not a macro

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-03 03:38:45 +00:00
parent c98d5c743f
commit e4b8bb4875
+9 -3
View File
@@ -21,7 +21,8 @@ void cmd_setchecksum(void), cmd_brick(void), swap(int partnum), writeGbe(void),
openFiles(void), cmd_copy(void), writeGbe_part(int), readGbe_part(int),
set_cmd(int, char **), setWord(int, int, uint16_t), check_bounds(int, int),
xopen (int *, const char *, int p, struct stat *), checkMacSeparator(int),
set_mac_byte(int, uint64_t *), usage(char*), set_io_flags(int, char **);
set_mac_byte(int, uint64_t *), usage(char*), set_io_flags(int, char **),
err_if(int);
int goodChecksum(int partnum), write_mac_part(int), set_err(int);
uint8_t hextonum(char chs), rhex(void);
uint16_t word(int, int);
@@ -60,8 +61,6 @@ op_t op[] = {
};
void (*cmd)(void) = NULL;
#define err_if(x) if (x) err(set_err(ECANCELED), "%s", fname)
int
main(int argc, char *argv[])
{
@@ -478,6 +477,13 @@ usage(char *util)
err(set_err(ECANCELED), "Too few arguments");
}
void
err_if(int x)
{
if (x)
err(set_err(ECANCELED), "%s", fname);
}
int
set_err(int x)
{