pspp-dev
[Top][All Lists]
Advanced

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

Re: hash.c


From: Ben Pfaff
Subject: Re: hash.c
Date: Sun, 21 Nov 2004 18:56:39 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

John Darrington <address@hidden> writes:

> /* Makes and returns a copy of the pointers to the data in H.
>    The returned data consists of hsh_count(H) non-null pointers,
>    in no particular order, followed by a null pointer.  The hash
>    table is not modified.  The caller is responsible for freeing
>    the allocated data. */
> void ** hsh_data_copy (struct hsh_table *h) ;
>
> This only does shallow copies.
>
> Can we make it take an optional parameter which is a pointer to a
> function which does the copy?  That way hashes of objects which
> contain pointers to dynamic data can be copied as deep copies.

Why not add a separate function to do that?  It could be a
wrapper that calls hsh_data_copy() then does a deep copy on each
returned pointer.
-- 
"...dans ce pays-ci il est bon de tuer de temps en temps un amiral
 pour encourager les autres."
--Voltaire, _Candide_




reply via email to

[Prev in Thread] Current Thread [Next in Thread]