| @@ -276,10 +276,25 @@ void av_freep(void *ptr); · 275 unmodified lines |
| 276 | 276 | * @param tab_ptr pointer to the array to grow |
| 277 | 277 | * @param nb_ptr pointer to the number of elements in the array |
| 278 | 278 | * @param elem element to add |
| 279 | | − * @see av_dynarray2_add() |
| 279 | + * @see av_dynarray_add_nofree(), av_dynarray2_add() |
| 280 | 280 | */ |
| 281 | 281 | void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); |
| 282 | 282 | |
| 283 | +/** |
| 284 | + * Add an element to a dynamic array. |
| 285 | + * |
| 286 | + * Function has the same functionality as av_dynarray_add(), |
| 287 | + * but it doesn't free memory on fails. It returns error code |
| 288 | + * instead and leave current buffer untouched. |
| 289 | + * |
| 290 | + * @param tab_ptr pointer to the array to grow |
| 291 | + * @param nb_ptr pointer to the number of elements in the array |
| 292 | + * @param elem element to add |
| 293 | + * @return >=0 on success, negative otherwise. |
| 294 | + * @see av_dynarray_add(), av_dynarray2_add() |
| 295 | + */ |
| 296 | +int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem); |
| 297 | + |
| 283 | 298 | /** |
| 284 | 299 | * Add an element of size elem_size to a dynamic array. |
| 285 | 300 | * |
| @@ -299,7 +314,7 @@ void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); · 13 unmodified lines |
| 299 | 314 | * the new added element is not filled. |
| 300 | 315 | * @return pointer to the data of the element to copy in the new allocated space. |
| 301 | 316 | * If NULL, the new allocated space is left uninitialized." |
| 302 | | − * @see av_dynarray_add() |
| 317 | + * @see av_dynarray_add(), av_dynarray_add_nofree() |
| 303 | 318 | */ |
| 304 | 319 | void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, |
| 305 | 320 | const uint8_t *elem_data); |