patch for libgcrypt 1.2.0 on pthreads

Werner Koch wk at gnupg.org
Tue Jun 29 16:19:07 CEST 2004


On Thu, 24 Jun 2004 16:16:24 -0700, Robey Pointer said:

> -  pthread_mutex_t *lock = malloc (sizeof (pthread_mutex_t));		      \
> +  pthread_mutex_t *lock = (pthread_mutex_t *)malloc (sizeof (pthread_mutex_t));	\

malloc returns void* and that type must be assignable to any other
pointer object.  Thus this patch does not make sense for C.

> -  { int err = pthread_mutex_destroy (*lock);  free (*lock); return err; }     \
> +{ int err = pthread_mutex_destroy ((pthread_mutex_t *)*lock);  free (*lock); return err; } \

See above.

> -  gcry_pthread_mutex_lock, gcry_pthread_mutex_unlock }
> +  gcry_pthread_mutex_lock, gcry_pthread_mutex_unlock, 0, 0, 0, 0, 0, 0, 0, 0}
Leaving out initializers will set the remaining elements to zero:

      [#21]  If  there  are fewer initializers in a brace-enclosed
       list than there are elements or members of an aggregate,  or
       fewer  characters  in a string literal used to initialize an
       array of known size than there are elements  in  the  array,
       the   remainder   of  the  aggregate  shall  be  initialized
       implicitly the same as  objects  that  have  static  storage
       duration.

Thus I can't see a reason to change it.



Shalom-Salam,

   Werner

 




More information about the Gcrypt-devel mailing list