Re: [PATCH 1/8] Add some helpers to manage the strings allocation/deallocation.

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

 



On 02/19/2013 06:59 PM, Zach Brown wrote:
>> Sorry but this is very dangerous and it leads to very subtle bug: what
>> happens if someone wrote:
> 
> "very dangerous"?  I disagree.
> 
> If you're worried about the value and units getting out of sync then you
> offer some helper macros:

No my complaint was related to another thing; but I was wrong. Anyway
your suggestion is not so easy applicable, and (IMHO) I don't see any
difficulty to remember to call string_list_free() only at the end of the
code.

> 
>> printf("%d%s - %d%s\n", scale(123), unit_string(123),
>> 	scale(123), unit_string(456) );
> 
> 	#define pty_fmt "%llu%s"
> 	#define pty_arg(v) scale(v), unit_string(v)
> 
> 	printf(pty_fmt, pty_arg(v));
> 
> The kernel used to print ipv4 addresses like this before it grew its own
> %pI4 format specifier.
> 
> - z
> 


-- 
gpg @keyserver.linux.it: Goffredo Baroncelli (kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux