]>
Commit | Line | Data |
---|---|---|
ac884b6a | 1 | // |
503b54c9 | 2 | // Shared data class for the CUPS PPD Compiler. |
ac884b6a | 3 | // |
503b54c9 MS |
4 | // Copyright 2007-2009 by Apple Inc. |
5 | // Copyright 2002-2005 by Easy Software Products. | |
ac884b6a | 6 | // |
e3101897 | 7 | // Licensed under Apache License v2.0. See the file "LICENSE" for more information. |
ac884b6a MS |
8 | // |
9 | ||
10 | // | |
11 | // Include necessary headers... | |
12 | // | |
13 | ||
38e73f87 | 14 | #include "ppdc-private.h" |
ac884b6a MS |
15 | |
16 | ||
17 | // | |
18 | // 'ppdcShared::ppdcShared()' - Create shared data. | |
19 | // | |
20 | ||
21 | ppdcShared::ppdcShared() | |
22 | { | |
23 | use = 1; | |
24 | } | |
25 | ||
26 | ||
27 | // | |
28 | // 'ppdcShared::~ppdcShared()' - Destroy shared data. | |
29 | // | |
30 | ||
31 | ppdcShared::~ppdcShared() | |
32 | { | |
33 | } | |
34 | ||
35 | ||
36 | // | |
e4572d57 | 37 | // 'ppdcShared::release()' - Decrement the use count and delete as needed. |
ac884b6a MS |
38 | // |
39 | ||
40 | void | |
e4572d57 | 41 | ppdcShared::release(void) |
ac884b6a | 42 | { |
e4572d57 | 43 | use --; |
97c9a8d7 MS |
44 | |
45 | #ifdef DEBUG | |
46 | if (use < 0) | |
47 | { | |
48 | fprintf(stderr, "ERROR: Over-release of %s: %p\n", class_name(), this); | |
49 | abort(); | |
50 | } | |
51 | #endif /* DEBUG */ | |
52 | ||
53 | if (use == 0) | |
e4572d57 | 54 | delete this; |
ac884b6a MS |
55 | } |
56 | ||
57 | ||
58 | // | |
e4572d57 | 59 | // 'ppdcShared::retain()' - Increment the use count for this data. |
ac884b6a MS |
60 | // |
61 | ||
62 | void | |
e4572d57 | 63 | ppdcShared::retain() |
ac884b6a | 64 | { |
e4572d57 | 65 | use ++; |
ac884b6a | 66 | } |