On Sun, Dec 14, 2003 at 06:11:40PM -0500, Greg Hudson wrote:
> On Sun, 2003-12-14 at 17:36, Ben Reser wrote:
> > The only way we might break that is by adding a member that causes the
> > compiler to pad the struct. Future changes might add more members that
> > then remove the need for the pad.
>
> The standard makes this unlikely to ever be a problem. There's a rule
> which says that if you put two structures with a common initial sequence
> inside a union, then you're allowed to set those fields within one
> structure and examine them within another, and it has to work. Although
> this guarantee technically only applies to unions, the only practical
> way to implement the rule is to ensure that the padding before each
> field within a structure never depends on the subsequent fields, only
> the previous ones.
Great, so even then we can workaround it by doing a union...
> I'm not sure that svn_config_ensure is really required. If you want to
> fill in ctx.config with your own configuration data, I think that's
> allowed.
That's true. So then adding it would violate the absolutely necessary
principle I put forth and it probably should stay out of the function.
> On the patch:
>
> > - svn_client_ctx_t ctx = { 0 };
> > + svn_client_ctx_t *ctx = NULL;
>
> Don't initialize the pointer to an invalid value; all that serves to do
> is defeat the compiler's logic for determining whether the pointer is
> used before it's initialized to a valid value.
Then someone should fix this 3 lines below my change too:
const svn_opt_subcommand_desc_t *subcommand = NULL;
:)
> > + svn_client_open(&ctx,pool);
>
> We always put a space after commas, and in this file we put a space
> before the open paren.
>
> (tools/examples/minimal_client.c has the same pair of problems.)
Whoops, and I thought I was being careful about the style.
I'll wait to see if there's a consensus on the naming issue and regen
the patch with these fixes, unless someone applies it with the fixes
themselves.
--
Ben Reser <ben@reser.org>
http://ben.reser.org
"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Dec 15 00:37:35 2003