Messages in this thread | | | Subject | Re: p = kmalloc(sizeof(*p), ) | From | Alan Cox <> | Date | Sun, 18 Sep 2005 18:47:10 +0100 |
| |
On Sul, 2005-09-18 at 19:25 +0300, Denis Vlasenko wrote: > > #define new_object(foo, gfp) (foo *)kmalloc(sizeof(foo), (gfp)) > > > > then you can > > > > x = new_object(struct frob, GFP_KERNEL) > > This will emit a warning if x is not a struct frob*, > which plain kmalloc doesn't do.
In the programs where I use it a lot (eg AberMUD5) I also in debugging mode pass in __FILE__ and __LINE__ which can be most handy. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |