From kde-commits Mon Sep 30 23:50:43 2002 From: Zack Rusin Date: Mon, 30 Sep 2002 23:50:43 +0000 To: kde-commits Subject: Re: kdenonbeta/kopete/protocols/gadu X-MARC-Message: https://marc.info/?l=kde-commits&m=103342993525845 On Monday 30 September 2002 19:41, Duncan Mac-Vicar Prett wrote: > El Monday 30 September 2002 18:45, Zack Rusin escribi=F3: > > Thanks, but the strings stuff is incorrect. > > p.password =3D password.latin1(); was OK, > > strcpy(p.password, password.latin1()); is not. > > > > Zack > > why? strcpy doesn't allocate memory, strdup does. p.password is just a=20 pointer and doesnt' have momory for the string allocated to it. latin1()=20 returns a const char* pointer valid for as long as the QString is there,=20 which in this case is the lifetime of that function, that's all we want,=20 we don't want to be unnecessarily copying/allocating memory. Zack =2D-=20 Dream as if you'll live forever.=20 Live as if you'll die tomorrow.=20