summaryrefslogtreecommitdiff
path: root/src/darray.h
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2017-06-26 21:49:49 +0100
committerDaniel Stone <daniels@collabora.com>2018-08-03 16:15:49 +0100
commit4fcbc47059aa6c714fa87bc24115edcad86ca5bb (patch)
tree71fa9e105cca6166f99effc505486771ff1451dc /src/darray.h
parentae7856db48be161cb336c44fd188253bc06dd5ae (diff)
downloadxorg-lib-libxkbcommon-4fcbc47059aa6c714fa87bc24115edcad86ca5bb.tar.gz
darray: Don't call memcpy() on NULL
The only time we could ever hit this was with count == 0, which seems unnecessarily pedantic. But OK. Signed-off-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'src/darray.h')
-rw-r--r--src/darray.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/darray.h b/src/darray.h
index e9da974..c30fd7d 100644
--- a/src/darray.h
+++ b/src/darray.h
@@ -104,7 +104,8 @@ typedef darray (unsigned long) darray_ulong;
#define darray_from_items(arr, items, count) do { \
unsigned __count = (count); \
darray_resize(arr, __count); \
- memcpy((arr).item, items, __count * sizeof(*(arr).item)); \
+ if (count != 0) \
+ memcpy((arr).item, items, __count * sizeof(*(arr).item)); \
} while (0)
#define darray_copy(arr_to, arr_from) \