[sheepdog] [PATCH v2] sockfd cache: grow fds count dynamically
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Tue Jul 24 04:31:29 CEST 2012
At Tue, 24 Jul 2012 09:44:32 +0800,
Liu Yuan wrote:
>
> On 07/23/2012 06:18 PM, MORITA Kazutaka wrote:
> > Isn't it easier to understand to write directly
> >
> > new->fds = xzalloc(sizeof(struct sockfd_cache_fd) * fds_count)
> >
> > than using a macro?
>
> This is used to get the new_size too, I think this easy macro is okay.
Well, I don't like this kind of macro usage.
From Linux kernel coding style:
==
CAPITALIZED macro names are appreciated but macros resembling functions
may be named in lower case.
...
Things to avoid when using macros:
2) macros that depend on having a local variable with a magic name:
#define FOO(val) bar(index, val)
might look like a good thing, but it's confusing as hell when one reads the
code and it's prone to breakage from seemingly innocent changes.
==
But it might be a matter of taste. I'm not against it if you think it
is useful.
Thanks,
Kazutaka
More information about the sheepdog
mailing list