Skip to content

Conversation

@alejandro-colomar
Copy link
Collaborator

@alejandro-colomar alejandro-colomar commented Sep 12, 2025


Revisions:

v2
  • Copy the structure at once.
$ git range-diff shadow/master gh/lor lor
-:  -------- > 1:  e5fa846c lib/subordinateio.c: append_range(): Copy the entire structure at once
1:  bbdb4e69 ! 2:  653d825f lib/subordinateio.c: Use REALLOCF() instead of its pattern
    @@ lib/subordinateio.c: static bool have_range(struct commonio_db *db,
     +  if (!*ranges)
                return false;
      
    --  sr[n].start = new->start;
    --  sr[n].count = new->count;
    +-  sr[n] = *new;
     -  *ranges = sr;
    -+  (*ranges)[n].start = new->start;
    -+  (*ranges)[n].count = new->count;
    ++  (*ranges)[n] = *new;
      
        return true;
      }
2:  292d9fe4 ! 3:  a8b7a924 lib/subordinateio.c: append_range(): Use reallocf(3)-like calling conventions
    @@ lib/subordinateio.c: static const struct subordinate_range *find_range(struct co
     +  if (ranges == NULL)
     +          return NULL;
      
    --  (*ranges)[n].start = new->start;
    --  (*ranges)[n].count = new->count;
    -+  ranges[n].start = new->start;
    -+  ranges[n].count = new->count;
    +-  (*ranges)[n] = *new;
    ++  ranges[n] = *new;
      
     -  return true;
     +  return ranges;
v2b
  • Revert v2.
$ git range-diff shadow/master gh/lor lor 
1:  e5fa846c < -:  -------- lib/subordinateio.c: append_range(): Copy the entire structure at once
2:  653d825f ! 1:  bbdb4e69 lib/subordinateio.c: Use REALLOCF() instead of its pattern
    @@ lib/subordinateio.c: static bool have_range(struct commonio_db *db,
     +  if (!*ranges)
                return false;
      
    --  sr[n] = *new;
    +-  sr[n].start = new->start;
    +-  sr[n].count = new->count;
     -  *ranges = sr;
    -+  (*ranges)[n] = *new;
    ++  (*ranges)[n].start = new->start;
    ++  (*ranges)[n].count = new->count;
      
        return true;
      }
3:  a8b7a924 ! 2:  292d9fe4 lib/subordinateio.c: append_range(): Use reallocf(3)-like calling conventions
    @@ lib/subordinateio.c: static const struct subordinate_range *find_range(struct co
     +  if (ranges == NULL)
     +          return NULL;
      
    --  (*ranges)[n] = *new;
    -+  ranges[n] = *new;
    +-  (*ranges)[n].start = new->start;
    +-  (*ranges)[n].count = new->count;
    ++  ranges[n].start = new->start;
    ++  ranges[n].count = new->count;
      
     -  return true;
     +  return ranges;
v2c
  • Rebase
$ git range-diff bbdb4e69b161^..292d9fe404a4 shadow/master..lor 
1:  bbdb4e69 = 1:  e2fd8cb6 lib/subordinateio.c: Use REALLOCF() instead of its pattern
2:  292d9fe4 = 2:  b9f45df1 lib/subordinateio.c: append_range(): Use reallocf(3)-like calling conventions
v2d
  • Rebase
$ git rd 
1:  e2fd8cb6 = 1:  2af81e48 lib/subordinateio.c: Use REALLOCF() instead of its pattern
2:  b9f45df1 = 2:  80152c9f lib/subordinateio.c: append_range(): Use reallocf(3)-like calling conventions
v2e
  • Rebase
$ git rd 
1:  2af81e48 = 1:  e52f343b lib/subordinateio.c: Use REALLOCF() instead of its pattern
2:  80152c9f = 2:  07208ac4 lib/subordinateio.c: append_range(): Use reallocf(3)-like calling conventions
v2f
  • Rebase
$ git rd 
1:  e52f343b8 = 1:  2ac540e15 lib/subordinateio.c: Use REALLOCF() instead of its pattern
2:  07208ac48 = 2:  07e235b81 lib/subordinateio.c: append_range(): Use reallocf(3)-like calling conventions
v2g
  • Rebase
$ git rd 
1:  2ac540e15 = 1:  89514bd9f lib/subordinateio.c: Use REALLOCF() instead of its pattern
2:  07e235b81 = 2:  db78701d2 lib/subordinateio.c: append_range(): Use reallocf(3)-like calling conventions
v2h
  • Rebase
$ git rd 
1:  89514bd9f ! 1:  56b8650b9 lib/subordinateio.c: Use REALLOCF() instead of its pattern
    @@ lib/subordinateio.c
      #include "alloc/malloc.h"
     -#include "alloc/realloc.h"
      #include "alloc/reallocf.h"
    - #include "atoi/str2i.h"
    + #include "atoi/a2i.h"
      #include "string/ctype/strisascii/strisdigit.h"
     @@ lib/subordinateio.c: static bool have_range(struct commonio_db *db,
      
2:  db78701d2 = 2:  c17a8cc80 lib/subordinateio.c: append_range(): Use reallocf(3)-like calling conventions

Signed-off-by: Alejandro Colomar <alx@kernel.org>
…ventions

By returning the new pointer, we can simplify the implementation,
and we avoid a return-by-parameter.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
@hallyn hallyn merged commit ceaca84 into shadow-maint:master Nov 28, 2025
11 checks passed
@alejandro-colomar alejandro-colomar self-assigned this Dec 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants