Re: svn commit: r106214 - /apr/apr/trunk/CHANGES /apr/apr/trunk/configure.in /apr/apr/trunk/include/apr.h.in /apr/apr/trunk/misc/unix/rand.c

2004-11-22 Thread Joe Orton
On Mon, Nov 22, 2004 at 08:14:26PM -, Paul Querna wrote:
 Author: pquerna
 Date: Mon Nov 22 12:14:25 2004
 New Revision: 106214
 
 Modified:
apr/apr/trunk/CHANGES
apr/apr/trunk/configure.in
apr/apr/trunk/include/apr.h.in
apr/apr/trunk/misc/unix/rand.c
 Log:
 Use uuid_generate() and uuid_create() for the apr_os_uuid_get() interface
 on platforms that support them.
 
 Tested On: Linux 2.6 (libuuid) and FreeBSD 5.2.1 (libc has uuid_create)

Neat... that's a good way fix for the why does the uuid code hang
forever problem (waiting for /dev/random).

 +memcpy( (void*)uuid_data, (const void *)g, sizeof( uuid_t ) );
 +

Please watch the code style, Paul!

joe


Re: svn commit: r106214 - /apr/apr/trunk/CHANGES /apr/apr/trunk/configure.in /apr/apr/trunk/include/apr.h.in /apr/apr/trunk/misc/unix/rand.c

2004-11-22 Thread Julian Foad
Joe Orton wrote:
On Mon, Nov 22, 2004 at 08:14:26PM -, Paul Querna wrote:
+memcpy( (void*)uuid_data, (const void *)g, sizeof( uuid_t ) );
Please watch the code style, Paul!
Not sure exactly what Joe is referring to, but note that it should never be 
necessary to cast anything to const void * - the whole point of accepting 
const void * is that it means accept pointers to anything, writable or not. 
 You don't need to cast to void * either unless the value you're casting was 
a pointer to const and you're casting away the const.

Casts are bad!
- Julian


Re: svn commit: r106214 - /apr/apr/trunk/CHANGES /apr/apr/trunk/configure.in /apr/apr/trunk/include/apr.h.in /apr/apr/trunk/misc/unix/rand.c

2004-11-22 Thread Cliff Woolley
On Mon, 22 Nov 2004, Julian Foad wrote:

 Joe Orton wrote:
  On Mon, Nov 22, 2004 at 08:14:26PM -, Paul Querna wrote:
 +memcpy( (void*)uuid_data, (const void *)g, sizeof( uuid_t ) );
 
  Please watch the code style, Paul!

 Not sure exactly what Joe is referring to, but note that it should never be
 necessary to cast anything to const void * - the whole point of accepting
 const void * is that it means accept pointers to anything, writable or 
 not.
   You don't need to cast to void * either unless the value you're casting 
 was
 a pointer to const and you're casting away the const.

Yes, the casts are unnecessary.  The other style problem to which Joe was
referring is the whitespace.  By Apache style, it should read:

memcpy(uuid_data, g, sizeof(uuid_t));

--Cliff


Re: svn commit: r106214 - /apr/apr/trunk/CHANGES /apr/apr/trunk/configure.in /apr/apr/trunk/include/apr.h.in /apr/apr/trunk/misc/unix/rand.c

2004-11-22 Thread Paul Querna
Joe Orton wrote:
On Mon, Nov 22, 2004 at 08:14:26PM -, Paul Querna wrote:
Author: pquerna
Date: Mon Nov 22 12:14:25 2004
New Revision: 106214
Modified:
  apr/apr/trunk/CHANGES
  apr/apr/trunk/configure.in
  apr/apr/trunk/include/apr.h.in
  apr/apr/trunk/misc/unix/rand.c
Log:
Use uuid_generate() and uuid_create() for the apr_os_uuid_get() interface
on platforms that support them.
Tested On: Linux 2.6 (libuuid) and FreeBSD 5.2.1 (libc has uuid_create)

Neat... that's a good way fix for the why does the uuid code hang
forever problem (waiting for /dev/random).
Thanks. I noticed the subversion people talking about it today, and I 
thought that apr_os_uuid_get() already used the native interfaces on 
FreeBSD and Linux, but I was disappointed to find it didn't.

+memcpy( (void*)uuid_data, (const void *)g, sizeof( uuid_t ) );
+

Please watch the code style, Paul!
Fixed. Thanks for keeping me honest.
-Paul