From: hno <> Date: Sat, 6 Jan 2001 18:39:43 +0000 (+0000) Subject: CBDATA_GLOBAL_TYPE can be used in globals.h to declare a global cbdata X-Git-Tag: SQUID_3_0_PRE1~1685 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f8a7e94e5f87bcbae2fa7853eb834e6df5097123;p=thirdparty%2Fsquid.git CBDATA_GLOBAL_TYPE can be used in globals.h to declare a global cbdata data type. --- diff --git a/doc/Programming-Guide/prog-guide.sgml b/doc/Programming-Guide/prog-guide.sgml index 9dee8e0ead..5c824505d1 100644 --- a/doc/Programming-Guide/prog-guide.sgml +++ b/doc/Programming-Guide/prog-guide.sgml @@ -2,7 +2,7 @@
Squid Programmers Guide Duane Wessels, Squid Developers -$Id: prog-guide.sgml,v 1.32 2001/01/06 11:09:43 hno Exp $ +$Id: prog-guide.sgml,v 1.33 2001/01/06 11:39:43 hno Exp $ Squid is a WWW Cache application developed by the National Laboratory @@ -2118,15 +2118,18 @@ coupling between the storage layer and the replacement policy.

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. + + + extern CBDATA_GLOBAL_TYPE(type_of_data); /* CBDATA_UNDEF */ +

TODO: Restructure the free function so there is one free function associated with the whole cbdata type rather than per allocation. -

- TODO: Add macros for global definitions outside cbdata.c. - Cache Manager diff --git a/src/defines.h b/src/defines.h index 26aeed31af..16066e306c 100644 --- a/src/defines.h +++ b/src/defines.h @@ -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/ @@ -285,7 +285,8 @@ /* 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