]> git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdc-shared.cxx
Fix source file header text duplication text duplication.
[thirdparty/cups.git] / ppdc / ppdc-shared.cxx
1 //
2 // Shared data class for the CUPS PPD Compiler.
3 //
4 // Copyright 2007-2009 by Apple Inc.
5 // Copyright 2002-2005 by Easy Software Products.
6 //
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
11 // missing or damaged, see the license at "http://www.cups.org/".
12 //
13
14 //
15 // Include necessary headers...
16 //
17
18 #include "ppdc-private.h"
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 //
41 // 'ppdcShared::release()' - Decrement the use count and delete as needed.
42 //
43
44 void
45 ppdcShared::release(void)
46 {
47 DEBUG_printf(("%s: %p release use=%d", class_name(), this, use));
48
49 use --;
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)
60 delete this;
61 }
62
63
64 //
65 // 'ppdcShared::retain()' - Increment the use count for this data.
66 //
67
68 void
69 ppdcShared::retain()
70 {
71 use ++;
72
73 DEBUG_printf(("%s: %p retain use=%d", class_name(), this, use));
74 }