Edward Bartolo <edb...@gmail.com> writes:

[...]

> Realloc uses two parameters: the first is a pointer whose allocation
> is to be modified/reallocated. The second is the NEW number of bytes
> required. In the function line 240 is:
> active_wifi_list = realloc(active_wifi_list, (((z - 1)/2) +
> list_delta)*sizeof(void*));
>
> I should assume that the assignment is unnecessary although it works.

The assignment is not uneccesary: On success, realloc returns a pointer
to the new area and the old pointer becomes invalid. If the allocation
can be extended in place, realloc may just return the old pointer,
however, if it can't, it will return a pointer to some newly-allocated
storage and the old will be freed.
_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to