[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gc_hash_buffer
From: |
Simon Josefsson |
Subject: |
Re: gc_hash_buffer |
Date: |
Tue, 11 Oct 2005 19:42:04 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> Simon Josefsson wrote:
>> Review most appreciated, as always.
>> ...
>> +/* Hashes. */
>> +extern int
>> +gc_hash_buffer (int hash, const void *in, size_t inlen, char *out);
>
> About the specification of this function: I can guess what 'in' and 'inlen'
> mean, but it's not clear what HASH is, what OUT is (and how much memory
> should be allocated for it), and what the return value is.
Thanks, I installed the patch below. I will write docstrings for all
of the functions eventually.
Index: gc.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/gc.h,v
retrieving revision 1.2
diff -u -p -u -w -r1.2 gc.h
--- gc.h 8 Oct 2005 09:26:59 -0000 1.2
+++ gc.h 11 Oct 2005 17:40:05 -0000
@@ -63,6 +63,12 @@ extern void gc_set_allocators (gc_malloc
gc_free_t func_free);
/* Hashes. */
+
+/* Compute a hash value over buffer IN of INLEN bytes size using the
+ algorithm HASH, placing the result in the pre-allocated buffer OUT.
+ The required size of OUT depends on HASH, and is generally
+ GC_<HASH>_DIGEST_SIZE. For example, for GC_MD5 the output buffer
+ must be 16 bytes. */
extern int
gc_hash_buffer (int hash, const void *in, size_t inlen, char *out);