[Toybox] [PATCH] modeprobe.c and last.c: Codeshare identical llist_add()

Rob Landley rob at landley.net
Wed Mar 27 07:14:45 PDT 2024


On 3/26/24 15:05, Oliver Webb via Toybox wrote:
> 2 identical versions of the same function, variable names and everything
> 
> 31 bytes saved in bloatcheck

The problem being it moves code from pending/ to lib/ whose only users are in
pending.

I've generally just done singly linked list additions inline. When you don't
mind reversing the list order it's literally two assignments and a dereference;

  node->next = head;
  head = node;

Pushing two arguments onto the stack and making a function call is approximately
as much code. (When I want to preserve list order I tend to use the existing
doubly linked list functions.)

Rob


More information about the Toybox mailing list