mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 23:40:10 +01:00
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:
parent
df3d3ea33e
commit
91ccbb399f
1 changed files with 2 additions and 4 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue