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

Re: svn commit: rev 4530 - in trunk/subversion: include libsvn_auth

From: <gstein_at_lyra.org>
Date: 2003-01-24 02:41:10 CET

On Thu, Jan 23, 2003 at 12:28:33PM -0600, sussman@tigris.org wrote:
...
 +++ trunk/subversion/libsvn_auth/auth.c Thu Jan 23 12:28:33 2003
...
 +svn_auth_register_provider (svn_auth_baton_t *auth_baton,
                              int order,
                              const svn_auth_provider_t *vtable,
                              void *provider_baton,
                              apr_pool_t *pool)
  {
 - abort();
 + /* ### ignoring the order argument for now, because it would be
 + complex to implement, and I can't see why it's worth it yet.
 + can't the caller just register providers in order? */
 +
 + provider_t *provider;
 + provider_set_t *table;
 +
 + /* Create the provider */
 + provider = apr_pcalloc (auth_baton-pool, sizeof(*provider));
 + provider-vtable = vtable;
 + provider-provider_baton = provider_baton;

You can simplify the allocations and whatnot by storing provider_t
structures into the array, rather than provider_t pointers.

Therefore:

...
 + table = apr_pcalloc (auth_baton-pool, sizeof(*table));

      table-providers = apr_array_make (auth_baton-pool, 1,
                                         sizeof (provider_t));

 + apr_hash_set (auth_baton-tables, vtable-cred_kind, APR_HASH_KEY_STRING,
 + table);
 + }
 + *(provider_t **)apr_array_push (table-providers) = provider;

  prov = (provider_t *)apr_array_push (table-providers);
  prov-vtable = vtable;
  prov-provider_baton = provider_baton;

[ note: the cast above is superfluous since apr_array_push returns void*; I
  left it in for descriptive purposes here; the decl will have the type info ]

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 14 02:11:05 2006

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