On Tue, Nov 11, 2014 at 5:45 AM, Miika Turkia <[email protected]> wrote:
>
> And the line calling strdup (in case my sources are slightly off sync):
>
> if (!same_string(displayedTrip.location, currentTrip->location)) {
> currentTrip->location = strdup(displayedTrip.location);
> mark_divelist_changed(true);
> }
That "strdup()" really should be "copy_string()".
The whole "same_string()" thing counts NULL as en empty string, so it
allows NULL. And that's *exactly* why we have "copy_string()" too,
allowing NULL (which will be copied as NULL).
Linus
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface