* [dpdk-dev] [PATCH] malloc: cleanup coding style
@ 2020-11-12 9:31 wangyunjian
2020-11-12 11:40 ` Burakov, Anatoly
0 siblings, 1 reply; 4+ messages in thread
From: wangyunjian @ 2020-11-12 9:31 UTC (permalink / raw)
To: dev
Cc: anatoly.burakov, rsanford2, jerry.lilijun, xudingke,
Yunjian Wang, stable
From: Yunjian Wang <wangyunjian@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@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@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;
- 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;
}
/*
--
2.19.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] malloc: cleanup coding style
2020-11-12 9:31 [dpdk-dev] [PATCH] malloc: cleanup coding style wangyunjian
@ 2020-11-12 11:40 ` Burakov, Anatoly
2020-11-12 13:41 ` wangyunjian
0 siblings, 1 reply; 4+ messages in thread
From: Burakov, Anatoly @ 2020-11-12 11:40 UTC (permalink / raw)
To: wangyunjian, dev; +Cc: rsanford2, jerry.lilijun, xudingke, stable
On 12-Nov-20 9:31 AM, wangyunjian wrote:
> From: Yunjian Wang <wangyunjian@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@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@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.
With that fixed,
Acked-by: Anatoly Burakov <anatoly.burakov@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] malloc: cleanup coding style
2020-11-12 11:40 ` Burakov, Anatoly
@ 2020-11-12 13:41 ` wangyunjian
2020-11-22 17:44 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: wangyunjian @ 2020-11-12 13:41 UTC (permalink / raw)
To: Burakov, Anatoly, dev; +Cc: rsanford2, Lilijun (Jerry), xudingke, stable
> -----Original Message-----
> From: Burakov, Anatoly [mailto:anatoly.burakov@intel.com]
> Sent: Thursday, November 12, 2020 7:40 PM
> To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> Cc: rsanford2@gmail.com; Lilijun (Jerry) <jerry.lilijun@huawei.com>; xudingke
> <xudingke@huawei.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] malloc: cleanup coding style
>
> On 12-Nov-20 9:31 AM, wangyunjian wrote:
> > From: Yunjian Wang <wangyunjian@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@dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunjian@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@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH] malloc: cleanup coding style
2020-11-12 13:41 ` wangyunjian
@ 2020-11-22 17:44 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2020-11-22 17:44 UTC (permalink / raw)
To: wangyunjian
Cc: Burakov, Anatoly, dev, stable, rsanford2, Lilijun (Jerry), xudingke
12/11/2020 14:41, wangyunjian:
> From: Burakov, Anatoly [mailto:anatoly.burakov@intel.com]
> > On 12-Nov-20 9:31 AM, wangyunjian wrote:
> > > From: Yunjian Wang <wangyunjian@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@dpdk.org
> > >
> > > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> > > ---
> > > --- 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?
No it is two indents from the beginning of the line,
while Anatoly was asking for double additional indent.
> > With that fixed,
I fix it.
> > Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-22 17:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 9:31 [dpdk-dev] [PATCH] malloc: cleanup coding style wangyunjian
2020-11-12 11:40 ` Burakov, Anatoly
2020-11-12 13:41 ` wangyunjian
2020-11-22 17:44 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).