Eric Blake 6c06d86d9a string: make VIR_STRDUP easier to use
While reviewing proposed VIR_STRDUP conversions, I've already noticed
several places that do:

if (str && VIR_STRDUP(dest, str) < 0)

which can be simplified by allowing str to be NULL (something that
strdup() doesn't allow).  Meanwhile, code that wants to ensure a
non-NULL dest regardless of the source can check for <= 0.

Also, make it part of the VIR_STRDUP contract that macro arguments
are evaluated exactly once.

* src/util/virstring.h (VIR_STRDUP, VIR_STRDUP_QUIET, VIR_STRNDUP)
(VIR_STRNDUP_QUIET): Improve contract.
* src/util/virstring.c (virStrdup, virStrndup): Change return
conventions.
* docs/hacking.html.in: Document this.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>

Conflicts:
	HACKING
	docs/hacking.html.in

(cherry picked from commit 6b74a9f5d98e066f8dfdf5d5ccda68230b516246)
2014-01-11 13:27:10 +01:00
..
2011-04-01 16:03:11 -06:00
2011-04-01 16:03:11 -06:00
2012-02-23 16:02:33 -07:00
2011-10-29 19:50:48 +02:00
2012-03-19 20:33:30 -04:00
2011-03-28 10:40:24 +08:00
2012-02-29 12:27:12 +01:00
2011-08-26 17:52:55 +02:00
2011-02-18 08:59:51 +01:00
2011-04-01 16:03:11 -06:00
2011-10-28 10:07:45 +01:00
2012-05-11 08:20:34 -06:00
2012-05-14 10:52:04 +08:00
2011-01-28 08:44:05 -07:00
2011-05-11 08:18:04 -06:00
2011-04-01 16:03:11 -06:00