//
// Shared data class for the CUPS PPD Compiler.
//
-// Copyright 2007-2008 by Apple Inc.
+// Copyright 2007-2009 by Apple Inc.
// Copyright 2002-2005 by Easy Software Products.
//
// These coded instructions, statements, and computer programs are the
//
// ppdcShared::ppdcShared() - Create shared data.
// ppdcShared::~ppdcShared() - Destroy shared data.
-// ppdcShared::get() - Increment the use count for this data.
// ppdcShared::release() - Decrement the use count and delete as needed.
+// ppdcShared::retain() - Increment the use count for this data.
//
//
// Include necessary headers...
//
-#include "ppdc.h"
+#include "ppdc-private.h"
//
//
-// 'ppdcShared::get()' - Increment the use count for this data.
+// 'ppdcShared::release()' - Decrement the use count and delete as needed.
//
void
-ppdcShared::get(void)
+ppdcShared::release(void)
{
- use ++;
+ DEBUG_printf(("%s: %p release use=%d", class_name(), this, use));
+
+ use --;
+
+#ifdef DEBUG
+ if (use < 0)
+ {
+ fprintf(stderr, "ERROR: Over-release of %s: %p\n", class_name(), this);
+ abort();
+ }
+#endif /* DEBUG */
+
+ if (use == 0)
+ delete this;
}
//
-// 'ppdcShared::release()' - Decrement the use count and delete as needed.
+// 'ppdcShared::retain()' - Increment the use count for this data.
//
void
-ppdcShared::release(void)
+ppdcShared::retain()
{
- use --;
- if (!use)
- delete this;
+ use ++;
+
+ DEBUG_printf(("%s: %p retain use=%d", class_name(), this, use));
}