]> git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdc-shared.cxx
License change: Apache License, Version 2.0.
[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 // Licensed under Apache License v2.0. See the file "LICENSE" for more information.
8 //
9
10 //
11 // Include necessary headers...
12 //
13
14 #include "ppdc-private.h"
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 //
37 // 'ppdcShared::release()' - Decrement the use count and delete as needed.
38 //
39
40 void
41 ppdcShared::release(void)
42 {
43 DEBUG_printf(("%s: %p release use=%d", class_name(), this, use));
44
45 use --;
46
47 #ifdef DEBUG
48 if (use < 0)
49 {
50 fprintf(stderr, "ERROR: Over-release of %s: %p\n", class_name(), this);
51 abort();
52 }
53 #endif /* DEBUG */
54
55 if (use == 0)
56 delete this;
57 }
58
59
60 //
61 // 'ppdcShared::retain()' - Increment the use count for this data.
62 //
63
64 void
65 ppdcShared::retain()
66 {
67 use ++;
68
69 DEBUG_printf(("%s: %p retain use=%d", class_name(), this, use));
70 }