Skip to content

Conversation

@alejandro-colomar
Copy link
Collaborator

@alejandro-colomar alejandro-colomar commented Jan 1, 2026


Revisions:

v2
$ git rd 
1:  5595da525 = 1:  5595da525 lib/list.c: Use for loop instead of while loop
-:  --------- > 2:  13e636554 lib/list.c: Use size_t for array indices and sizes
v2b
  • Use size_t earlier.
$ git rd 
1:  5595da525 ! 1:  37c85da55 lib/list.c: Use for loop instead of while loop
    @@ lib/list.c: bool is_on_list (char *const *list, const char *member)
      
     -  while (NULL != *list) {
     -          if (streq(*list, member)) {
    -+  for (int i = 0; list[i] != NULL; i++) {
    ++  for (size_t i = 0; list[i] != NULL; i++) {
     +          if (streq(list[i], member))
                        return true;
     -          }
2:  13e636554 ! 2:  fe073f5b9 lib/list.c: Use size_t for array indices and sizes
    @@ lib/list.c: del_list(/*@returned@*/ /*@only@*/char **list, const char *member)
      
        assert (NULL != list);
      
    -@@ lib/list.c: bool is_on_list (char *const *list, const char *member)
    -   assert (NULL != member);
    -   assert (NULL != list);
    - 
    --  for (int i = 0; list[i] != NULL; i++) {
    -+  for (size_t i = 0; list[i] != NULL; i++) {
    -           if (streq(list[i], member))
    -                   return true;
    -   }

@alejandro-colomar alejandro-colomar added the Simpler A good issue for a new beginner label Jan 1, 2026
@alejandro-colomar alejandro-colomar self-assigned this Jan 1, 2026
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reported-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Suggested-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Simpler A good issue for a new beginner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants