Stefan Sperling <[email protected]> writes: > Not objecting to this change, but I believe we do have a few > batons on the stack in several places and I don't think this > is a problem in general.
It's perfectly acceptable to use a stack variable for a baton but it has to be in the same scope as function call. In this case moving the stack variable outside the if() block would have been an alternative solution. > The stack memory will be available until the function returns, > which in this case is svn_cl__merge() i.e. the main entry point > to the subcommand. > > The scope shouldn't matter since there's no garbage collection in C. The scope does matter: the C standard specifies that the lifetime of an object "extends from entry into the block with which it is associated until execution of that block ends" [6.2.4]. An optimising compiler is free to reuse stack slots once out of scope, either for other stack variables or for stack space to call a function. -- Philip Martin WANdisco

