]>
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 | // |
503b54c9 MS |
7 | // These coded instructions, statements, and computer programs are the |
8 | // property of Apple Inc. and are protected by Federal copyright | |
9 | // law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
10 | // which should have been included with this file. If this file is | |
57b7b66b | 11 | // missing or damaged, see the license at "http://www.cups.org/". |
ac884b6a MS |
12 | // |
13 | ||
14 | // | |
15 | // Include necessary headers... | |
16 | // | |
17 | ||
38e73f87 | 18 | #include "ppdc-private.h" |
ac884b6a MS |
19 | |
20 | ||
21 | // | |
22 | // 'ppdcShared::ppdcShared()' - Create shared data. | |
23 | // | |
24 | ||
25 | ppdcShared::ppdcShared() | |
26 | { | |
27 | use = 1; | |
28 | } | |
29 | ||
30 | ||
31 | // | |
32 | // 'ppdcShared::~ppdcShared()' - Destroy shared data. | |
33 | // | |
34 | ||
35 | ppdcShared::~ppdcShared() | |
36 | { | |
37 | } | |
38 | ||
39 | ||
40 | // | |
e4572d57 | 41 | // 'ppdcShared::release()' - Decrement the use count and delete as needed. |
ac884b6a MS |
42 | // |
43 | ||
44 | void | |
e4572d57 | 45 | ppdcShared::release(void) |
ac884b6a | 46 | { |
38e73f87 | 47 | DEBUG_printf(("%s: %p release use=%d", class_name(), this, use)); |
94da7e34 | 48 | |
e4572d57 | 49 | use --; |
97c9a8d7 MS |
50 | |
51 | #ifdef DEBUG | |
52 | if (use < 0) | |
53 | { | |
54 | fprintf(stderr, "ERROR: Over-release of %s: %p\n", class_name(), this); | |
55 | abort(); | |
56 | } | |
57 | #endif /* DEBUG */ | |
58 | ||
59 | if (use == 0) | |
e4572d57 | 60 | delete this; |
ac884b6a MS |
61 | } |
62 | ||
63 | ||
64 | // | |
e4572d57 | 65 | // 'ppdcShared::retain()' - Increment the use count for this data. |
ac884b6a MS |
66 | // |
67 | ||
68 | void | |
e4572d57 | 69 | ppdcShared::retain() |
ac884b6a | 70 | { |
e4572d57 | 71 | use ++; |
94da7e34 | 72 | |
38e73f87 | 73 | DEBUG_printf(("%s: %p retain use=%d", class_name(), this, use)); |
ac884b6a | 74 | } |