apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luke Kenneth Casson Leighton <l...@samba-tng.org>
Subject Re: cvs commit: apr/memory/unix apr_sms_blocks.c
Date Thu, 14 Jun 2001 12:04:00 GMT
is there a pointer-type-cast-and-add macro around?

#define PTR_OFFS(ptr, offset) (void*) (((size_t)((char*)ptr)) + offset)
#define PTR_DIFF(ptr1, ptr2) (size_t) (((size_t)((char*)ptr1)) + ((size_t)((char*)ptr2)) )

did i get that right?

luke


On Thu, Jun 14, 2001 at 01:58:44PM +0200, Sander Striker wrote:
> Hi Jeff,
> 
> Could you back this one out and change the types in
> apr_sms_blocks_t to char *?
> 
> struct apr_sms_blocks_t
> {
>     apr_sms_t            header;
>     apr_size_t           block_sz;
>     char                *ptr;
>     char                *endp;
>     block_t             *free_list;
>     block_t             *external_list;
>     apr_lock_t          *lock;
> };
> 
> Sander
> 
> > trawick     01/06/14 04:44:04
> > 
> >   Modified:    memory/unix apr_sms_blocks.c
> >   Log:
> >   can't add to void *; pretend it is char *
> >   
> >   Revision  Changes    Path
> >   1.4       +2 -2      apr/memory/unix/apr_sms_blocks.c
> >   
> >   Index: apr_sms_blocks.c
> >   ===================================================================
> >   RCS file: /home/cvs/apr/memory/unix/apr_sms_blocks.c,v
> >   retrieving revision 1.3
> >   retrieving revision 1.4
> >   diff -u -r1.3 -r1.4
> >   --- apr_sms_blocks.c	2001/06/14 10:59:18	1.3
> >   +++ apr_sms_blocks.c	2001/06/14 11:44:03	1.4
> >   @@ -113,7 +113,7 @@
> >        }
> >        
> >        mem = BLOCKS_T(sms)->ptr;
> >   -    BLOCKS_T(sms)->ptr += BLOCKS_T(sms)->block_sz;
> >   +    BLOCKS_T(sms)->ptr = (char *)(BLOCKS_T(sms)->ptr) + 
> > BLOCKS_T(sms)->block_sz;
> >    
> >        if (BLOCKS_T(sms)->ptr > BLOCKS_T(sms)->endp)
> >            return NULL;
> >   @@ -135,7 +135,7 @@
> >        }
> >        
> >        mem = BLOCKS_T(sms)->ptr;
> >   -    BLOCKS_T(sms)->ptr += BLOCKS_T(sms)->block_sz;
> >   +    BLOCKS_T(sms)->ptr = (char *)(BLOCKS_T(sms)->ptr) + 
> > BLOCKS_T(sms)->block_sz;
> >    
> >        if (BLOCKS_T(sms)->ptr > BLOCKS_T(sms)->endp)
> >            return NULL;
> >   
> >   
> >   
> > 
> > 
> > 

Mime
View raw message