<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
<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
/*
- * $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