<div dir="ltr">Otherwise, calling cairo_set_user_data(cr, key, 0, 0) many times<br>causes a long user data array, almost all of whose slots are empty.<br>It leads to unnecessarily much memory consumption and long execution time of<br>cairo_set_user_data(cr, key, 0, 0) and cairo_get_user_data(cr, key) after it.<br>---<br> src/cairo-array.c | 3 +++<br> 1 file changed, 3 insertions(+)<br><br>diff --git a/src/cairo-array.c b/src/cairo-array.c<br>index 4f3c082..58c9a38 100644<br>--- a/src/cairo-array.c<br>+++ b/src/cairo-array.c<br>@@ -485,6 +485,9 @@ _cairo_user_data_array_set_data (cairo_user_data_array_t *array,<br> return CAIRO_STATUS_SUCCESS;<br> }<br> <br>+ if (user_data == NULL)<br>+ return CAIRO_STATUS_SUCCESS;<br>+<br> status = _cairo_array_append (array, &new_slot);<br> if (unlikely (status))<br> return status;<br>-- <br>1.7.9.5<br><br></div>
<br>
.