All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] part: show efi partition name when print out partition info
Date: Wed, 07 Sep 2011 21:21:54 +0200	[thread overview]
Message-ID: <20110907192154.6C99E140875D@gemini.denx.de> (raw)
In-Reply-To: <1315394223-12399-1-git-send-email-leiwen@marvell.com>

Dear Lei Wen,

In message <1315394223-12399-1-git-send-email-leiwen@marvell.com> you wrote:
...
> +static char *print_efiname(gpt_entry *pte)
> +{
> +	static char name[37];

I hate these magic constants where nobody knows where they are coming
from.  Please use the size of the partition_name[] array for reference
instead.

> +	int i;
> +	for (i = 0; i < 37; i++) {

Again, drop this magic constant.  Also note that 37 is actually wrong
here - you are accessing an element beyond the end of partition_name[]

> +		u8 c;
> +		c = pte->partition_name[i] & 0xff;
> +		c = (c && !isprint(c)) ? '!' : c;

Why do you use '!' to mark nonprinting characters?  Most memory dump
tools atc. use '.' instead.

> +		name[i] = c;
> +	}
> +	name[36] = 0;

And again: get rid of this constant.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The thing is, as you progress in the Craft,  you'll  learn  there  is
another rule... When you break rules, break 'em good and hard.
                                    - Terry Pratchett, _Wyrd Sisters_

  parent reply	other threads:[~2011-09-07 19:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-07 11:17 [U-Boot] [PATCH] part: show efi partition name when print out partition info Lei Wen
2011-09-07 11:27 ` Marek Vasut
2011-09-07 11:29   ` Lei Wen
2011-09-07 12:29     ` Marek Vasut
2011-09-07 13:13 ` [U-Boot] [PATCH V1] " Lei Wen
2011-09-07 13:17   ` [U-Boot] [PATCH V2] " Lei Wen
2011-09-07 19:23     ` Wolfgang Denk
2011-09-07 19:21 ` Wolfgang Denk [this message]
2011-09-08  4:11   ` [U-Boot] [PATCH V3] " Lei Wen
2011-09-29  2:14     ` Lei Wen
2011-09-29 16:16       ` Marek Vasut
2011-09-30  1:45         ` Lei Wen
2011-10-05  2:07           ` Lei Wen
2011-10-06 18:42     ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110907192154.6C99E140875D@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.