Re: [PATCH v3 08/27] revisions API users: add "goto cleanup" for "rev_info" early exit

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

 



Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes:

> It would be a lot cleaner to be able to initialize "struct rev_info"
> with "{ 0 }" here, or if a "REV_INFO_INIT" existed, we'll hopefully
> get around to making the initialization easier in the future (now it
> can't be done via a macro).

If "struct rev_info" can be initialized with "{ 0 }" here, i.e.

-	struct rev_info rev;
+	struct rev_info rev = { 0 };

to give us a valid solution, why wouldn't you be able to do

+#define REV_INFO_INIT { 0 }

elsewhere in a common *.h file, and then

-	struct rev_info rev;
+	struct rev_info rev = REV_INFO_INIT;

to make the fact that "rev" is initialized (and ready to be handed
to the releaser) even more explicit?  It's like arguing against
fixing a code like this:

	struct char *pointer;
	...
	if (condition)
		pointer = malloc(...);
	...
        /* pointer leaks */
 
by initializing

	struct char *pointer = NULL;
	...
	if (condition)
		pointer = malloc(...);
	...
        free(pointer);

because for some reason you are against the macro NULL but you are
willing to spell it out as "0" (without double-quotes)?

Puzzled.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux