[dlls/msi/*] Strncpy elimination.

Alexandre Julliard julliard at winehq.org
Mon Mar 28 11:59:02 CST 2005


Peter Berg Larsen <pebl at math.ku.dk> writes:

> This memcpyies one element more than needed.. but seemed much nicer than
> memcpy( ret, p, (len - 1)*sizeof(WHCAR);
> 
> I probably should have subtracted one from len, making it obvious
> that this is a strdupW, like:
>   ret = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof(WCHAR) );
>   memcpy( ret, p, len*sizeof(WCHAR) );
>   ret[len] = 0;

If it's really a strdup it's cleaner to copy one more char and get rid
of the ret[len] = 0.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list