mirror of
https://github.com/opnsense/src.git
synced 2026-02-18 18:20:26 -05:00
smbios: style(9): smbios_cksum()
Reduce some variables' lifecycle. Remove useless casts. Remove superfluous braces. Add some consts. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation (cherry picked from commit ef446a8065ac0228a5da15f233cd2f964e4d7433)
This commit is contained in:
parent
55e8cdff14
commit
cc1cb8e376
1 changed files with 7 additions and 8 deletions
|
|
@ -339,25 +339,24 @@ smbios_eps3 (void *v)
|
|||
static int
|
||||
smbios_cksum (void *v)
|
||||
{
|
||||
struct smbios3_eps *eps3;
|
||||
struct smbios_eps *eps;
|
||||
u_int8_t *ptr;
|
||||
const u_int8_t *ptr;
|
||||
u_int8_t cksum;
|
||||
u_int8_t length;
|
||||
int i;
|
||||
|
||||
if (smbios_eps3(v)) {
|
||||
eps3 = (struct smbios3_eps *)v;
|
||||
const struct smbios3_eps *eps3 = v;
|
||||
|
||||
length = eps3->length;
|
||||
} else {
|
||||
eps = (struct smbios_eps *)v;
|
||||
const struct smbios_eps *eps = v;
|
||||
|
||||
length = eps->length;
|
||||
}
|
||||
ptr = (u_int8_t *)v;
|
||||
ptr = v;
|
||||
cksum = 0;
|
||||
for (i = 0; i < length; i++) {
|
||||
for (i = 0; i < length; i++)
|
||||
cksum += ptr[i];
|
||||
}
|
||||
|
||||
return (cksum);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue