Re: [PATCH] Allow hash tables to use generic pointers as keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, Feb 22, 2011 at 05:54:31PM +0000, Daniel P. Berrange wrote:
> +virHashTablePtr virHashCreateFull(int size, virHashDeallocator deallocator,
> +                                  virHashCode code, virHashEqual equal,
> +                                  virHashCopy copy, virHashRelease release)

I find the naming confusing/non obvious here, virHashDeallocator VS
virHashRelease, and virHashCopy is vague as to what it copies. What about
virHashKeyRelease (or Deallocator, or Free), virHashValueRelease and
virHashKeyCopy?


>  {
>      virHashTablePtr table = NULL;
>  
> @@ -103,6 +127,10 @@ virHashCreate(int size, virHashDeallocator deallocator)
>      table->size = size;
>      table->nbElems = 0;
>      table->f = deallocator;

"f" could be changed to a more obvious name now that there are different
function pointers in virHash, but that's not directly related to this
patch.

> +    table->code = code;
> +    table->equal = equal;
> +    table->copy = copy;
> +    table->release = release;

> diff --git a/src/util/hash.h b/src/util/hash.h
> index cf08e1a..6316fd9 100644
> --- a/src/util/hash.h
> +++ b/src/util/hash.h

> +typedef unsigned long (*virHashCode)(const void *name);
> +typedef bool (*virHashEqual)(const void *namea, const void *nameb);
> +typedef void *(*virHashCopy)(const void *name);
> +typedef void (*virHashRelease)(void *name);

Can these function pointers be documented, the others in this file
already have doc :)

Christophe

Attachment: pgp4b7UIbT0dW.pgp
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]