dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [dmidecode] [PATCH 2/3] dmioem: Rename the first parameter of dmi_se


From: Erwan Velu
Subject: Re: [dmidecode] [PATCH 2/3] dmioem: Rename the first parameter of dmi_set_vendor
Date: Tue, 1 Dec 2020 17:36:57 +0100

Why not being more explicit and name it vendor instead of v ?
That's way easier to newcomers to understand the code.

Le mar. 1 déc. 2020 à 17:31, Jean Delvare <jdelvare@suse.de> a écrit :

> When dmi_set_vendor took a single parameter, naming it "s" for
> "string" was OK. But now it takes two, so this could be confusing.
> Rename "s" to "v" to make it clear it is the vendor.
>
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> ---
>  dmioem.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> --- dmidecode.orig/dmioem.c     2020-12-01 15:40:11.520716322 +0100
> +++ dmidecode/dmioem.c  2020-12-01 15:41:01.093262342 +0100
> @@ -50,7 +50,7 @@ static const char *dmi_product = NULL;
>   * value if we know how to decode at least one specific entry type for
>   * that vendor.
>   */
> -void dmi_set_vendor(const char *s, const char *p)
> +void dmi_set_vendor(const char *v, const char *p)
>  {
>         const struct { const char *str; enum DMI_VENDORS id; } vendor[] = {
>                 { "Acer",                       VENDOR_ACER },
> @@ -68,14 +68,14 @@ void dmi_set_vendor(const char *s, const
>          * Often DMI strings have trailing spaces. Ignore these
>          * when checking for known vendor names.
>          */
> -       len = strlen(s);
> -       while (len && s[len - 1] == ' ')
> +       len = strlen(v);
> +       while (len && v[len - 1] == ' ')
>                 len--;
>
>         for (i = 0; i < ARRAY_SIZE(vendor); i++)
>         {
>                 if (strlen(vendor[i].str) == len &&
> -                   strncmp(s, vendor[i].str, len) == 0)
> +                   strncmp(v, vendor[i].str, len) == 0)
>                 {
>                         dmi_vendor = vendor[i].id;
>                         break;
>
> --
> Jean Delvare
> SUSE L3 Support
>
> _______________________________________________
> https://lists.nongnu.org/mailman/listinfo/dmidecode-devel
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]