]> git.ipfire.org Git - thirdparty/cups.git/blame - ppdc/ppdc-shared.cxx
License change: Apache License, Version 2.0.
[thirdparty/cups.git] / ppdc / ppdc-shared.cxx
CommitLineData
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
21ppdcShared::ppdcShared()
22{
23 use = 1;
24}
25
26
27//
28// 'ppdcShared::~ppdcShared()' - Destroy shared data.
29//
30
31ppdcShared::~ppdcShared()
32{
33}
34
35
36//
e4572d57 37// 'ppdcShared::release()' - Decrement the use count and delete as needed.
ac884b6a
MS
38//
39
40void
e4572d57 41ppdcShared::release(void)
ac884b6a 42{
38e73f87 43 DEBUG_printf(("%s: %p release use=%d", class_name(), this, use));
94da7e34 44
e4572d57 45 use --;
97c9a8d7
MS
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)
e4572d57 56 delete this;
ac884b6a
MS
57}
58
59
60//
e4572d57 61// 'ppdcShared::retain()' - Increment the use count for this data.
ac884b6a
MS
62//
63
64void
e4572d57 65ppdcShared::retain()
ac884b6a 66{
e4572d57 67 use ++;
94da7e34 68
38e73f87 69 DEBUG_printf(("%s: %p retain use=%d", class_name(), this, use));
ac884b6a 70}