CVS update: samba/source/lib

Simo Sorce idra at samba.org
Mon Jul 15 18:01:00 EST 2002


On Mon, 2002-07-15 at 04:43, Andrew Bartlett wrote:
> Simo Sorce wrote:
> > 
> > Date:   Sun Jul 14 15:21:39 2002
> > Author: idra
> > 
> > Update of /data/cvs/samba/source/lib
> > In directory va:/tmp/cvs-serv6718/lib
> > 
> > Modified Files:
> >         util_str.c substitute.c
> > Log Message:
> > addedd new (t)alloc_sub_* functions
> > they will get a const string and return a (t)alloced epanded one.
> > also modified passdb/* stuff to use this one.
> 
> These look good, but I am a little worried about the realloc every
> time.   Copying to a pstring is ugly, but I'm worried about the constand
> Realloc() - this code gets called a *lot*.
> 
> Also, can you confirm this is intentional:
> 
> --- samba/source/lib/util_str.c 2002/07/09 23:59:46     1.53
> +++ samba/source/lib/util_str.c 2002/07/14 22:21:39     1.54
> @@ -762,7 +762,7 @@
>                                 return NULL;
>                         }
>                         string = t;
> -                       s = t + (p - s);
> +                       p = t + (p - s);
>                 }
>                 if (li != lp) {
>                         memmove(p+li,p+lp,strlen(p+lp)+1);
> 
> I have no reason to beleive its correct/incorrect, but it looked out of
> place.  I'm assuming this code already functioned, so what does this
> change do?

If I change it there was a reason ;)
It wasn't working.

I were updateing the wrong variabile, think at the subsequent memove.
If after realloc you do not update *p what will get moved??
s does not matter at all, as it will get set later on.

Simo.


-- 
Simo Sorce
----------
Una scelta di liberta': Software Libero.
A choice of freedom: Free Software.
http://www.softwarelibero.it




More information about the samba-cvs mailing list