lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 04 Oct 2011 14:18:53 -0700
From:	Joe Perches <joe@...ches.com>
To:	Dave Hansen <dave@...ux.vnet.ibm.com>
Cc:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	rientjes@...gle.com, James.Bottomley@...senPartnership.com,
	hpa@...or.com
Subject: Re: [RFCv3][PATCH 1/4] replace string_get_size() arrays

On Tue, 2011-10-04 at 13:51 -0700, Dave Hansen wrote:
> On Tue, 2011-10-04 at 13:42 -0700, Joe Perches wrote:
> > > Right, but we're only handling u64.
> > So the declaration should be:
> >         static const char byte_units[] = " KMGTPE";
> I guess that's worth a comment.  But that first character doesn't get
> used.  There were two alternatives:
> 	static const char byte_units[] = "_KMGTPE";

or
	static const char byte_units[] = { 0, 'K', 'M', 'G', 'T', 'P', 'E' };

and use ARRAY_SIZE(byte_units) not strlen(byte_units)
for array size maximum.

> or something along the lines of:
> +	static const char byte_units[] = "KMGTPE";
> ...
> +	index--;
> +       /* index=-1 is plain 'B' with no other unit */
> +       if (index >= 0) {
> 
> We don't ever _actually_ look at the space (or underscore).  I figured
> the _ was nicer since it would be _obvious_ if it ever got printed out
> somehow.  

shrug.  It's all the same stuff.

cheers, Joe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ