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

RE: [PATCH] extend svn_subst_translate_string() to record whether re-encoding and/or line ending translation were performed

From: Bert Huijben <bert_at_qqmail.nl>
Date: Fri, 1 Oct 2010 13:14:23 +0200

> -----Original Message-----
> From: Julian Foad [mailto:julian.foad_at_wandisco.com]
> Sent: vrijdag 1 oktober 2010 12:58
> To: Daniel Trebbien
> Cc: Subversion Development; Daniel Shahaf; Gavin Beau Baumanis
> Subject: Re: [PATCH] extend svn_subst_translate_string() to record
> whether re-encoding and/or line ending translation were performed

[Copying from this mail, as it already quotes the sources that are separate attachments for me]

> Please update the doc string of this function to mention the new
> parameter, or write a partial doc string if it doesn't have one. (Hmm,
> I see it does have one but it's quite inaccurate. I will update the
> current version now.)
>
> > @@ -650,7 +651,13 @@ translate_newline(const char *eol_str,
> > *src_format_len = newline_len;
> > }
> > /* Translate the newline */
> > - return translate_write(dst, eol_str, eol_str_len);
> > + svn_error_t *err = translate_write(dst, eol_str, eol_str_len);
>
> No declarations mixed in with statements - we stick to C'89 rules. But
> I don't think there is any need to insert this new code *after* the
> write - it can just as well go before the write, leaving the 'return'
> how it was.

The code can just use SVN_ERR() here, as you can't be sure the output is available in error conditions anyway, so the extra check can be avoided on errors.
>
> > + if (eol_translated) {
> > + if (newline_len != eol_str_len ||
> > + strncmp(newline_buf, eol_str, newline_len))
> > + *eol_translated = TRUE;
> > + }
> > + return err;

And this can be a return SVN_NO_ERROR;

> > }

        Bert
Received on 2010-10-01 13:15:12 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.