On Wed, Nov 09, 2016 at 11:27:47AM +0100, Patrick Steinhardt wrote: > Hi, > > while continuing my work on the obstructed checkout patch I just > updated to the new `svn_client_list4` call, which introduced a > new `patterns` parameter. I initially run into a `NULL` pointer > derefeernce, as I expected that the patterns parameter may also > be `NULL`, as it is often the case for parameters which are not > in use. > > The attached patch changes the function to accept a `NULL` > argument for `parameters` in addition to an empty array, which is > mostly a convenience/consistency thing for callers of the new > function. > > Regards > Patrick
I agree with this semantic API change. Should this patch not also adjust the docstring for svn_client_list4() in the file subversion/include/svn_client.h? > > [[[ > svn_client_list4: accept `NULL` patterns > > The recently introduced `svn_client_list4` introduced a new > parameter `patterns`, which can be used to filter listed paths. > When an empty pattern array is passed to the function, all paths > are being reported. > > In the case where a caller does not want to filter the list, > he first has to create an empty array. Improve usability by also > allowing a caller to pass in a `NULL` pointer instead of an empty > array. > > * subversion/libsvn_repos/list.c: > (matches_any): Return `TRUE` if `patterns` is `NULL` > ]]] > -- > Patrick Steinhardt, Entwickler > > elego Software Solutions GmbH, http://www.elego.de > Gebäude 12 (BIG), Gustav-Meyer-Allee 25, 13355 Berlin, Germany > > Sitz der Gesellschaft: Berlin, USt-IdNr.: DE 163214194 > Handelsregister: Amtsgericht Charlottenburg HRB 77719 > Geschäftsführer: Olaf Wagner > diff --git a/subversion/libsvn_repos/list.c b/subversion/libsvn_repos/list.c > index d52e193..47d92a5 100644 > --- a/subversion/libsvn_repos/list.c > +++ b/subversion/libsvn_repos/list.c > @@ -97,7 +97,7 @@ matches_any(const char *dirname, > apr_array_header_t *patterns) > { > int i; > - if (!patterns->nelts) > + if (!patterns || !patterns->nelts) > return TRUE; > > for (i = 0; i < patterns->nelts; ++i)