Fix various errors in list_destroy()

As reported by cppcheck:

    src/list.c:45:8: style: Redundant initialization for 'data'. The
    initialized value is overwritten before it is read.
    [redundantInitialization]
      data = NULL;
       	   ^
    src/list.c:43:15: note: data is initialized
      void * data = list_pop_front(list);
              	  ^
    src/list.c:45:8: note: data is overwritten
      data = NULL;
       	   ^
This commit is contained in:
Glenn Y. Rolland 2020-02-14 08:34:01 +01:00
parent f24b8bd3a8
commit 17088c631f

View file

@ -40,9 +40,7 @@ void list_destroy(List_t * list){
// sans détruire les données dedans ? // sans détruire les données dedans ?
while(!list_is_empty(list)){ while(!list_is_empty(list)){
pDEBUG("destroying front cell\n"); pDEBUG("destroying front cell\n");
void * data = list_pop_front(list); list_pop_front(list);
pDEBUG("set data to NULL\n");
data = NULL;
} }
free(list); free(list);
} }