| 305 | */ |
| 306 | |
| 307 | void |
| 308 | cupsArrayDelete(cups_array_t *a) /* I - Array */ |
| 309 | { |
| 310 | /* |
| 311 | * Range check input... |
| 312 | */ |
| 313 | |
| 314 | if (!a) |
| 315 | return; |
| 316 | |
| 317 | /* |
| 318 | * Free the elements if we have a free function (otherwise the caller is |
| 319 | * responsible for doing the dirty work...) |
| 320 | */ |
| 321 | |
| 322 | if (a->freefunc) |
| 323 | { |
| 324 | int i; /* Looping var */ |
| 325 | void **e; /* Current element */ |
| 326 | |
| 327 | for (i = a->num_elements, e = a->elements; i > 0; i --, e ++) |
| 328 | (a->freefunc)(*e, a->data); |
| 329 | } |
| 330 | |
| 331 | /* |
| 332 | * Free the array of element pointers... |
| 333 | */ |
| 334 | |
| 335 | if (a->alloc_elements) |
| 336 | free(a->elements); |
| 337 | |
| 338 | if (a->hashsize) |
| 339 | free(a->hash); |
| 340 | |
| 341 | free(a); |
| 342 | } |
| 343 | |
| 344 | |
| 345 | /* |
no outgoing calls