Andr� Malo wrote:
Just got a report via PM about a gcc warning during 2.0.46 compile:

System:
gcc: 2.95.3
Linux 2.4.18 Conectiva 8

configured with worker MPM.

apr_md5.c:688: warning: `crypt_mutex_lock' defined but not used
apr_md5.c:693: warning: `crypt_mutex_unlock' defined but not used

The attached patch should avoid these, shouldn't it? (untested).

seems very likely, but I haven't tested it either :)

I think some more serious reimplementation is appropriate for that function anyway.

I think it would be cleaner if apr_initialize() set up =>1 thread mutexes for its use and apr-util's use, and export those via a global array and mutex count, then apr_password_validate(), and any other code with a similar problem, would use that.

#if APR_HAS_THREADS
struct {
    apr_thread_mutex_t **mutexes;
    int mutex_count;
} apr_private_mutexes;
#endif

count would be guaranteed >= 1

then apr_password_validate() wouldn't have to have its own mutex allocation handling; it would just use one of the available internal APR mutexes

#if APR_HAS_THREADS && !defined(APU_CRYPT_THREADSAFE)
  apr_thread_mutex_lock(apr_private_mutexes.mutexes[0]);
  crypt();
  apr_thread_mutex_unlock(apr_private_mutexes.mutexes[0]);
#else
  crypt();
#endif



Reply via email to