Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 16248 invoked by uid 6000); 14 Jan 1998 21:45:42 -0000 Received: (qmail 16233 invoked from network); 14 Jan 1998 21:45:39 -0000 Received: from pen.sentuny.com.au (rono@203.12.98.6) by taz.hyperreal.org with SMTP; 14 Jan 1998 21:45:39 -0000 Received: from localhost (rono@localhost) by pen.sentuny.com.au (8.8.8/8.8.8) with SMTP id IAA31324 for ; Thu, 15 Jan 1998 08:45:35 +1100 Date: Thu, 15 Jan 1998 08:45:35 +1100 (EST) From: "Ron O'Hara" To: new-httpd@apache.org Subject: PR number 1652 Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Hi, This is my first post to this list with an attempted patch to resolve a problem so feedback on whatever I have wrong is very welcome. Anyway - PR 1652 ... proposed patch This was applied to the stock Apache 1.3b3 sources and compiles cleanly uner Linux 2.0.33 Regards Ron O'Hara -------------------cut here ------------------------------------ *** alloc.c.dist Mon Jan 12 15:25:20 1998 --- alloc.c Mon Jan 12 15:31:10 1998 *************** *** 65,70 **** --- 65,77 ---- #include + /* allow co-existence with API's from other products which already use + the 'palloc' routine name but have differnet parameters and + functionality. ROH Jan 12th 1998 + */ + #define palloc(a,b) ap_palloc(a,b) + + /* debugging support, define this to enable code which helps detect re-use * of freed memory and other such nonsense. * *************** *** 441,447 **** */ ! API_EXPORT(void *) palloc(struct pool *a, int reqsize) { #ifdef ALLOC_USE_MALLOC int size = reqsize + CLICK_SZ; --- 448,454 ---- */ ! API_EXPORT(void *) ap_palloc(struct pool *a, int reqsize) { #ifdef ALLOC_USE_MALLOC int size = reqsize + CLICK_SZ; *** alloc.h.dist Mon Jan 12 15:25:28 1998 --- alloc.h Mon Jan 12 15:28:41 1998 *************** *** 96,103 **** API_EXPORT(void) cleanup_for_exec(void); /* routines to allocate memory from an pool... */ ! API_EXPORT(void *) palloc(struct pool *, int nbytes); API_EXPORT(void *) pcalloc(struct pool *, int nbytes); API_EXPORT(char *) pstrdup(struct pool *, const char *s); API_EXPORT(char *) pstrndup(struct pool *, const char *s, int n); --- 96,109 ---- API_EXPORT(void) cleanup_for_exec(void); /* routines to allocate memory from an pool... */ + #ifndef USE_AP_PALLOC + /* workaround rount name/parameter conflicts with third party products + (Like PostgreSQL 6.2.1) which also have their own 'palloc' routine + R O'Hara */ + #define palloc(a,b) ap_palloc(a,b) + #endif ! API_EXPORT(void *) ap_palloc(struct pool *, int nbytes); API_EXPORT(void *) pcalloc(struct pool *, int nbytes); API_EXPORT(char *) pstrdup(struct pool *, const char *s); API_EXPORT(char *) pstrndup(struct pool *, const char *s, int n); ---------- Forwarded message ---------- Date: Thu, 15 Jan 1998 08:37:38 +1100 From: xxxx Reply-To: dont.bother@spam.me.silly.net To: rono@sentuny.com.au Subject: xxxxxxxx Subject: Conflict of routine 'palloc' name/parameters with other software (PostgreSQL) X-Send-Pr-Version: 3.2 >Number: 1652 >Category: apache-api >Synopsis: Conflict of routine 'palloc' name/parameters with other software (PostgreSQL) >Confidential: no >Severity: critical >Priority: medium >Responsible: apache >State: open >Class: change-request >Submitter-Id: apache >Arrival-Date: Sun Jan 11 17:40:01 PST 1998 >Last-Modified: >Originator: rono@sentuny.com.au >Organization: apache >Release: 1.3 >Environment: Linux 2.0.33, gcc etc - Not Relevant to problem >Description: I'm writing a user module for apache that is using the PostgreSQL 6.2.1 C client api. This API has a routine called 'palloc'. The Apache server has it's own routine called 'palloc'. The routines have different parameters. The name conflict needs to be removed - I have submitted a Bug report to the postgres team, and will modify the Apache code as a workaround, but the same problem could easily occur with Apache routines which use common names and other ill behaved product API's (Oracle ?). >How-To-Repeat: Add the Postgres #include 'libpq-fe.h' to the start of 'mod_usertrack'. >Fix: --- partial solution to namespace conflicts (common routines only) --- Change the internal name of Apache's palloc routine to 'ap_palloc' [a very non-standard name] and change 'alloc.h' to #define palloc to refer to the 'ap_palloc' routine if USE_AP_PALLOC is not defined. IE. #ifndef USE_AP_PALLOC #define palloc(a,b) ap_alloc(a,b) #endif (The same is needed for 'pcalloc', 'pstrdup', 'pstrndup' and 'pstrcat') Impact of change is reduced to the 'alloc.c' and 'alloc.h' routines (plus any naughty routines that dont have a #include 'alloc.h' but still use 'palloc') This allows a developer of a user module to utilise other tools which want to supply their own 'palloc' routine and still have access to the core Apache routines via their real internal names. %0 >Audit-Trail: >Unformatted: [In order for any reply to be added to the PR database, ] [you need to include in the Cc line ] [and leave the subject line UNCHANGED. This is not done] [automatically because of the potential for mail loops. ]