Re: mark parsing in fast-import

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shawn,

Shawn O. Pearce schrieb am Sun 20. Apr, 20:26 (-0400):
> Jrg Sommer <joerg@xxxxxxxxxxxx> wrote:
> > +static inline int parse_mark(const const char *str, uintmax_t* mark,

Is inline okay?

> > +	char **after_mark)
> > +{
> > +	if (!str || str[0] != ':' || !isdigit(str[1]))
> > +		return 1;
> > +
> > +	char *am;
> 
> Although we conform to mostly C99 style, variables should be
> declared at the top of the scope and not after a statement.

Changed.

> >  static void cmd_mark(void)
> >  {
> > -	if (!prefixcmp(command_buf.buf, "mark :")) {
> > -		next_mark = strtoumax(command_buf.buf + 6, NULL, 10);
> > +	uintmax_t mark = 0;
> > +	char *after_mark = NULL;
> > +
> > +	if (!prefixcmp(command_buf.buf, "mark ") &&
> > +		parse_mark(&command_buf.buf[5], &mark, &after_mark) &&
> 
> Hmm.  Shouldn't this be ! parse_mark given that it returns 0
> on success and 1 on failure?

Yes, you're right. I've checked some other functions and found this
behaviour. Can I use a different behabiour, i.e. return 0 on failure and
!0 on success?

Bye, Jörg.
-- 
„Wer im Usenet gelesen werden will, sollte leserorientiert schreiben. Wer nur
 für sich schreiben will, dem ist mit einem Tagebuch vielleicht besser
 geholfen. Gelesen zu werden ist kein Recht, sondern ein Privileg.“
     Thore Tams in <90tfv8$49b$1@xxxxxxxxxxxxxxxxxxxxxxx>

Attachment: signature.asc
Description: Digital signature http://en.wikipedia.org/wiki/OpenPGP


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux