Re: [RFCv3][PATCH 1/4] replace string_get_size() arrays

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

 



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 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.  

-- Dave

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]