On Fri, Jun 26, 2015 at 2:50 PM, Anton Lundin <[email protected]> wrote:
> We store no value as a NULL, so we can omit that value from the xml and
> git files.
Ack.
However, it strikes me that maybe we should just teach "copy_string()"
to do this. That would match "same_string()", and copy_string()
already returns NULL today (although only if you passed in NULL), so
it really would match that too.
If people wanted strdup(), they should use strdup(). copy_string is
very much about our "empty and NULL are the same string" model.
So maybe a simpler patch instead? Something (totally untested!) like:
static inline char *copy_string(const char *s)
{
- return s ? strdup(s) : NULL;
+ return (s && *s) ? strdup(s) : NULL;
}
Hmm?
Linus
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface