util/xmlconfig: Drop silly open-coded strdup.

The comment about using "malloc"?  The strdup man page says 'Memory for
the new string is obtained with malloc(3), and can be freed with free(3)'

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6916>
This commit is contained in:
Eric Anholt 2020-09-10 16:45:14 -07:00 committed by Marge Bot
parent df3d3ea33e
commit 91ccbb399f

View file

@ -92,14 +92,12 @@ findOption(const driOptionCache *cache, const char *name)
return hash;
}
/** \brief Like strdup but using malloc and with error checking. */
/** \brief Like strdup with error checking. */
#define XSTRDUP(dest,source) do { \
uint32_t len = strlen (source); \
if (!(dest = malloc(len+1))) { \
if (!(dest = strdup(source))) { \
fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); \
abort(); \
} \
memcpy (dest, source, len+1); \
} while (0)
static int compare (const void *a, const void *b) {