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

Re: svn commit: r1104124 - in /subversion/trunk/subversion: include/svn_io.h libsvn_subr/deprecated.c libsvn_subr/io.c

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Tue, 17 May 2011 14:42:40 +0200

Julian Foad wrote on Tue, May 17, 2011 at 12:00:25 +0100:
> Not directly related to your change, but I notice the impl. allows the
> passed-in string to be null if not wanted. Maybe the doc string should
> promise that,

/me nods

> otherwise why bother?
>

Because the existing code allowed NULLs, I made the new code accept
NULLs as well.

> - Julian
>
>
> On Tue, 2011-05-17 at 10:55 +0000, danielsh_at_apache.org wrote:
> > Author: danielsh
> > Date: Tue May 17 10:55:51 2011
> > New Revision: 1104124
> >
> > URL: http://svn.apache.org/viewvc?rev=1104124&view=rev
> > Log:
> > Revv the svn_io_file_create() API to take non-NUL-terminated strings.
> >
> > * subversion/include/svn_io.h
> > (svn_io_file_create2): New.
> > (svn_io_file_create): Deprecate.
> >
> > * subversion/libsvn_subr/io.c
> > (svn_io_file_create2): Renamed from svn_io_file_create().
> >
> > * subversion/libsvn_subr/deprecated.c
> > (svn_io_file_create): New wrapper.
> >
> > Modified:
> > subversion/trunk/subversion/include/svn_io.h
> > subversion/trunk/subversion/libsvn_subr/deprecated.c
> > subversion/trunk/subversion/libsvn_subr/io.c
> >
> > Modified: subversion/trunk/subversion/include/svn_io.h
> > URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_io.h?rev=1104124&r1=1104123&r2=1104124&view=diff
> > ==============================================================================
> > --- subversion/trunk/subversion/include/svn_io.h (original)
> > +++ subversion/trunk/subversion/include/svn_io.h Tue May 17 10:55:51 2011
> > @@ -645,7 +645,20 @@ svn_io_files_contents_same_p(svn_boolean
> > /** Create file at utf8-encoded @a file with contents @a contents.
> > * @a file must not already exist.
> > * Use @a pool for memory allocations.
> > + *
> > + * @since New in 1.7.
> > + */
> > +svn_error_t *
> > +svn_io_file_create2(const char *file,
> > + const svn_string_t *contents,
> > + apr_pool_t *scratch_pool);
> > +
> > +/** Like svn_io_file_create2(), but with a C string instead
> > + * of an #svn_string_t.
> > + *
> > + * @deprecated Provided for backward compatibility with the 1.6 API.
> > */
> > +SVN_DEPRECATED
> > svn_error_t *
> > svn_io_file_create(const char *file,
> > const char *contents,
> >
> > Modified: subversion/trunk/subversion/libsvn_subr/deprecated.c
> > URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/deprecated.c?rev=1104124&r1=1104123&r2=1104124&view=diff
> > ==============================================================================
> > --- subversion/trunk/subversion/libsvn_subr/deprecated.c (original)
> > +++ subversion/trunk/subversion/libsvn_subr/deprecated.c Tue May 17 10:55:51 2011
> > @@ -630,6 +630,17 @@ svn_opt_print_generic_help(const char *h
> >
> > /*** From io.c ***/
> > svn_error_t *
> > +svn_io_file_create(const char *file,
> > + const char *contents,
> > + apr_pool_t *pool)
> > +{
> > + const svn_string_t *contents_string;
> > +
> > + contents_string = (contents ? svn_string_create(contents, pool) : NULL);
> > + return svn_io_file_create2(file, contents_string, pool);
> > +}
> > +
> > +svn_error_t *
> > svn_io_open_unique_file2(apr_file_t **file,
> > const char **temp_path,
> > const char *path,
> >
> > Modified: subversion/trunk/subversion/libsvn_subr/io.c
> > URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1104124&r1=1104123&r2=1104124&view=diff
> > ==============================================================================
> > --- subversion/trunk/subversion/libsvn_subr/io.c (original)
> > +++ subversion/trunk/subversion/libsvn_subr/io.c Tue May 17 10:55:51 2011
> > @@ -1092,9 +1092,9 @@ svn_io_make_dir_recursively(const char *
> > return SVN_NO_ERROR;
> > }
> >
> > -svn_error_t *svn_io_file_create(const char *file,
> > - const char *contents,
> > - apr_pool_t *pool)
> > +svn_error_t *svn_io_file_create2(const char *file,
> > + const svn_string_t *contents,
> > + apr_pool_t *pool)
> > {
> > apr_file_t *f;
> > apr_size_t written;
> > @@ -1104,8 +1104,8 @@ svn_error_t *svn_io_file_create(const ch
> > (APR_WRITE | APR_CREATE | APR_EXCL),
> > APR_OS_DEFAULT,
> > pool));
> > - if (contents && *contents)
> > - err = svn_io_file_write_full(f, contents, strlen(contents),
> > + if (contents && contents->len)
> > + err = svn_io_file_write_full(f, contents->data, contents->len,
> > &written, pool);
> >
> >
> >
> >
>
>
Received on 2011-05-17 13:43:27 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.