Thread (1 message) 1 message, 1 author, 2008-10-04

Re: [PATCH] Implement and use an xstrdup() function

From: David Gibson <hidden>
Date: 2008-10-04 02:41:42

Possibly related (same subject, not in this thread)

On Fri, Oct 03, 2008 at 12:15:08PM -0500, Jon Loeliger wrote:
Many places in dtc use strdup(), but none of them actually check the
return value to see if the implied allocation succeeded.  This is a
potential bug, which we fix in the patch below by replacing strdup()
with an xstrdup() which in analogy to xmalloc() will quit with a fatal
error if the allocation fails.

I felt the introduciton of util.[ch] was a better choice
for utility oriented code than directly using srcpos.c
for the new string function.
Fair enough.  Now that we have a util.c, we should move die() and
xmalloc() in there as well which are currently duplicated between dtc
and convert-dtsv0.
This patch is a re-factoring of Dave Gibson's similar patch.

Signed-off-by: Jon Loeliger <redacted>
Acked-by: David Gibson <redacted>

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help