]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - ppdc/ppdc-shared.cxx
Dropped the old Epson Stylus Color/Photo sample drivers since they don't work
[thirdparty/cups.git] / ppdc / ppdc-shared.cxx
index 6b7cba1c2c3dc22cf3f1df4550e3ccee1e3a59af..0c99c0859717afe8d0b942eb204873344643d4ef 100644 (file)
@@ -3,7 +3,7 @@
 //
 //   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"
 
 
 //
@@ -47,26 +47,39 @@ ppdcShared::~ppdcShared()
 
 
 //
-// '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));
 }