All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stack: improve source code readability
@ 2026-08-11 12:17 Morten Brørup
  2026-08-11 15:48 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Morten Brørup @ 2026-08-11 12:17 UTC (permalink / raw)
  To: dev; +Cc: Morten Brørup

Fixed misleading local variable names in the standard stack,
for improved source code readability.
No functional change.

Fixes: 05d3b5283cc1 ("stack: introduce stack library")

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
No need to backport.
---
 lib/stack/rte_stack_std.h | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/stack/rte_stack_std.h b/lib/stack/rte_stack_std.h
index ae28add5c4..d5b21defb0 100644
--- a/lib/stack/rte_stack_std.h
+++ b/lib/stack/rte_stack_std.h
@@ -25,20 +25,20 @@ __rte_stack_std_push(struct rte_stack *s, void * const *obj_table,
 {
 	struct rte_stack_std *stack = &s->stack_std;
 	unsigned int index;
-	void **cache_objs;
+	void **stack_objs;
 
 	rte_spinlock_lock(&stack->lock);
-	cache_objs = &stack->objs[stack->len];
+	stack_objs = &stack->objs[stack->len];
 
-	/* Is there sufficient space in the stack? */
-	if ((stack->len + n) > s->capacity) {
+	if (unlikely((stack->len + n) > s->capacity)) {
+		/* Insufficient space in the stack. */
 		rte_spinlock_unlock(&stack->lock);
 		return 0;
 	}
 
-	/* Add elements back into the cache */
+	/* Push objects to the stack */
 	for (index = 0; index < n; ++index, obj_table++)
-		cache_objs[index] = *obj_table;
+		stack_objs[index] = *obj_table;
 
 	stack->len += n;
 
@@ -63,20 +63,22 @@ __rte_stack_std_pop(struct rte_stack *s, void **obj_table, unsigned int n)
 {
 	struct rte_stack_std *stack = &s->stack_std;
 	unsigned int index, len;
-	void **cache_objs;
+	void **stack_objs;
 
 	rte_spinlock_lock(&stack->lock);
 
 	if (unlikely(n > stack->len)) {
+		/* Insufficient objects in the stack. */
 		rte_spinlock_unlock(&stack->lock);
 		return 0;
 	}
 
-	cache_objs = stack->objs;
+	stack_objs = stack->objs;
 
+	/* Pop objects from the stack */
 	for (index = 0, len = stack->len - 1; index < n;
 			++index, len--, obj_table++)
-		*obj_table = cache_objs[len];
+		*obj_table = stack_objs[len];
 
 	stack->len -= n;
 	rte_spinlock_unlock(&stack->lock);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] stack: improve source code readability
  2026-08-11 12:17 [PATCH] stack: improve source code readability Morten Brørup
@ 2026-08-11 15:48 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2026-08-11 15:48 UTC (permalink / raw)
  To: Morten Brørup; +Cc: dev

On Tue, 11 Aug 2026 12:17:27 +0000
Morten Brørup <mb@smartsharesystems.com> wrote:

> Fixed misleading local variable names in the standard stack,
> for improved source code readability.
> No functional change.
> 
> Fixes: 05d3b5283cc1 ("stack: introduce stack library")
> 
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> ---

Makes sense, but drop Fixes since that implies it is a bug fix.
Cleanups don't need fixes.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-11 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11 12:17 [PATCH] stack: improve source code readability Morten Brørup
2026-08-11 15:48 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.