[dpdk-dev] [PATCH] malloc: cleanup coding style
wangyunjian
wangyunjian at huawei.com
Thu Nov 12 14:41:05 CET 2020
> -----Original Message-----
> From: Burakov, Anatoly [mailto:anatoly.burakov at intel.com]
> Sent: Thursday, November 12, 2020 7:40 PM
> To: wangyunjian <wangyunjian at huawei.com>; dev at dpdk.org
> Cc: rsanford2 at gmail.com; Lilijun (Jerry) <jerry.lilijun at huawei.com>; xudingke
> <xudingke at huawei.com>; stable at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] malloc: cleanup coding style
>
> On 12-Nov-20 9:31 AM, wangyunjian wrote:
> > From: Yunjian Wang <wangyunjian at huawei.com>
> >
> > Cleanup code style issue reported by kernel checkpatch. As follows:
> > * ERROR:CODE_INDENT: code indent should use tabs where possible
> > * ERROR:SPACING: spaces required around that '?' (ctx:VxE)
> > * WARNING:INDENTED_LABEL: labels should not be indented
> >
> > Fixes: b0489e7bca2f ("malloc: fix linear complexity")
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
> > ---
> > lib/librte_eal/common/malloc_elem.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/librte_eal/common/malloc_elem.c
> b/lib/librte_eal/common/malloc_elem.c
> > index c70112f84d..99cbfd02dc 100644
> > --- a/lib/librte_eal/common/malloc_elem.c
> > +++ b/lib/librte_eal/common/malloc_elem.c
> > @@ -391,14 +391,14 @@ malloc_elem_free_list_index(size_t size)
> > return 0;
> >
> > /* Find next power of 2 >= size. */
> > - log2 = sizeof(size) * 8 - __builtin_clzl(size-1);
> > + log2 = sizeof(size) * 8 - __builtin_clzl(size - 1);
> >
> > /* Compute freelist index, based on log2(size). */
> > index = (log2 - MALLOC_MINSIZE_LOG2 +
> MALLOC_LOG2_INCREMENT - 1) /
> > - MALLOC_LOG2_INCREMENT;
> > + MALLOC_LOG2_INCREMENT;
>
> Here and below, I believe we usually add two indents to the continuation
> line, to avoid confusing with things like if statements.
It is already two indents in the patch. Please double check?
Thanks,
Yunjian
>
> With that fixed,
>
> Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
>
> >
> > - return index <= RTE_HEAP_NUM_FREELISTS-1?
> > - index: RTE_HEAP_NUM_FREELISTS-1;
> > + return index <= RTE_HEAP_NUM_FREELISTS - 1 ?
> > + index : RTE_HEAP_NUM_FREELISTS - 1;
> > }
> >
> > /*
> >
>
>
> --
> Thanks,
> Anatoly
More information about the dev
mailing list