| 444 | */ |
| 445 | |
| 446 | void |
| 447 | cupsdDeleteSubscription( |
| 448 | cupsd_subscription_t *sub, /* I - Subscription object */ |
| 449 | int update) /* I - 1 = update subscriptions.conf, 0 = don't update, -1 = don't update and don't lock */ |
| 450 | { |
| 451 | /* |
| 452 | * Close the pipe to the notifier as needed... |
| 453 | */ |
| 454 | |
| 455 | if (sub->pipe >= 0) |
| 456 | close(sub->pipe); |
| 457 | |
| 458 | /* |
| 459 | * Remove subscription from array... |
| 460 | */ |
| 461 | |
| 462 | if (update >= 0) |
| 463 | _cupsRWLockWrite(&SubscriptionsLock); |
| 464 | |
| 465 | cupsArrayRemove(Subscriptions, sub); |
| 466 | |
| 467 | if (update >= 0) |
| 468 | _cupsRWUnlock(&SubscriptionsLock); |
| 469 | |
| 470 | /* |
| 471 | * Free memory... |
| 472 | */ |
| 473 | |
| 474 | _cupsRWDestroy(&sub->lock); |
| 475 | |
| 476 | cupsdClearString(&(sub->owner)); |
| 477 | cupsdClearString(&(sub->recipient)); |
| 478 | |
| 479 | cupsArrayDelete(sub->events); |
| 480 | |
| 481 | free(sub); |
| 482 | |
| 483 | /* |
| 484 | * Update the subscriptions as needed... |
| 485 | */ |
| 486 | |
| 487 | if (update > 0) |
| 488 | cupsdMarkDirty(CUPSD_DIRTY_SUBSCRIPTIONS); |
| 489 | } |
| 490 | |
| 491 | |
| 492 | /* |
no test coverage detected