]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
CBDATA_GLOBAL_TYPE can be used in globals.h to declare a global cbdata
authorhno <>
Sat, 6 Jan 2001 18:39:43 +0000 (18:39 +0000)
committerhno <>
Sat, 6 Jan 2001 18:39:43 +0000 (18:39 +0000)
data type.

doc/Programming-Guide/prog-guide.sgml
src/defines.h

index 9dee8e0eadd19d6723dc24cd1459bf3a21c74e8c..5c824505d18481cb5adfdf553e369559b0becea2 100644 (file)
@@ -2,7 +2,7 @@
 <article>
 <title>Squid Programmers Guide</title>
 <author>Duane Wessels, Squid Developers
-<date>$Id: prog-guide.sgml,v 1.32 2001/01/06 11:09:43 hno Exp $</date>
+<date>$Id: prog-guide.sgml,v 1.33 2001/01/06 11:39:43 hno Exp $</date>
 
 <abstract>
 Squid is a WWW Cache application developed by the National Laboratory
@@ -2118,15 +2118,18 @@ coupling between the storage layer and the replacement policy.
        <P>
        To add new global data types one have to add them to the 
        cbdata_type enum in enums.h, and a corresponding 
-       CREATE_CBDATA call in cbdata.c:cbdataInit().
+       CREATE_CBDATA call in cbdata.c:cbdataInit(). Or alternatively
+       add a CBDATA_GLOBAL_TYPE definition to globals.h and use
+       CBDATA_INIT_TYPE as described above.
+
+<verb>
+       extern CBDATA_GLOBAL_TYPE(type_of_data);        /* CBDATA_UNDEF */
+</verb>
 
        <P>
        TODO: Restructure the free function so there is one free function
        associated with the whole cbdata type rather than per allocation.
 
-       <P>
-       TODO: Add macros for global definitions outside cbdata.c.
-
 <!-- %%%% Chapter : CACHE MANAGER %%%% -->
 <sect>Cache Manager
 
index 26aeed31af29cf6028a418a54330569258426f84..16066e306caf323220f613784dcd7e6cfcf2069b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: defines.h,v 1.85 2001/01/05 09:51:37 adrian Exp $
+ * $Id: defines.h,v 1.86 2001/01/06 11:39:43 hno Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
 /* cbdata macros */
 #define CBDATA_ALLOC(type, unl) ((type *)cbdataInternalAlloc(CBDATA_##type, unl))
 #define CBDATA_TYPE(type)      static cbdata_type CBDATA_##type = 0
-#define CBDATA_INIT_TYPE(type) (CBDATA_##type = cbdataAddType(CBDATA_##type, #type, sizeof(type)))
+#define CBDATA_GLOBAL_TYPE(type)       cbdata_type CBDATA_##type
+#define CBDATA_INIT_TYPE(type) (CBDATA_##type ? (CBDATA_##type = cbdataAddType(CBDATA_##type, #type, sizeof(type))) : 0)
 
 #ifndef O_TEXT
 #define O_TEXT 0