[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r39997 - trunk/tools/server-side

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Tue, 13 Oct 2009 22:03:45 +0200 (Jerusalem Standard Time)

David Glasser wrote on Tue, 13 Oct 2009 at 12:45 -0700:
> On Oct 13, 2009 12:27 PM, "Daniel Shahaf" <tigris_at_danielsh.fastmail.net>
> wrote:
>
> > +struct key_t
> > +{
> > + svn_revnum_t revision;
> > + apr_off_t offset;
> > +};
> > +
> > +/* What we need to know about a rep. */
> > +struct value_t
> > +{
> > + svn_checksum_t *sha1_checksum;
> > + apr_uint64_t refcount;
> > +};
...
> > + apr_hash_set(records, key, sizeof(*key), value);
>
> Is it legit to hash on a struct? Couldn't there be padding bytes?

While this doesn't answer the question, we have precedent in
libsvn_fs_base/bdb/env.c:

    apr_hash_set(bdb_cache, &bdb->key, sizeof bdb->key, NULL);

where bdb->key is the following struct:

    typedef struct
    {
      apr_dev_t device;
      apr_ino_t inode;
    } bdb_env_key_t;

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2407307
Received on 2009-10-13 22:41:16 CEST

This is an archived mail posted to the Subversion Dev mailing list.