Re: [PATCH 1/4] add generic, type aware object chain walker

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

 



mkoegler@xxxxxxxxxxxxxxxxx (Martin Koegler) writes:

> What about
> #define OBJ_BAD -2

You mean "#define OBJ_ANY -2"?

>> After all, if the walker callback was told with
>> OBJ_ANY that any type of object is Ok, it should still say
>> "oops" if the given object said it actually is of type OBJ_BAD.
>> E.g. in your [2/4] patch:
>> 
>>         +static int mark_object(struct object *obj, int type, void *data)
>>         +{
>>         + ...
>>         +	if (type != OBJ_ANY && obj->type != type) {
>>         +		objerror(parent, "wrong object type in link");
>>         +	}
>> 
>> if you use the above #define, a tagged object that has a bad
>> type will pass this check unnoticed, won't it?
>
> No, it wouldn't, as object->type is never initialized to OBJ_BAD:
> $ grep "OBJ_BAD" *.c *.h
> cache.h:        OBJ_BAD = -1,

Don't you think that is too subtle?  Don't you want to future
proof your code?

Using the OBJ_ANY (which I'd agree is a good name) that is
different from anything else that is already defined would be a
good idea for that, I would think.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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