All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Derek Fults <dfults@sgi.com>
Cc: linux-kernel@vger.kernel.org, Andi Kleen <ak@suse.de>
Subject: Re: [PATCH] Add get_range, allows a hyhpenated range to get_options
Date: Wed, 01 Nov 2006 10:20:49 -0800	[thread overview]
Message-ID: <4548E581.1010509@oracle.com> (raw)
In-Reply-To: <1162404964.9524.524.camel@lnx-dfults.americas.sgi.com>

Derek Fults wrote:
>> How does get_range() handle errors, like input of
>> 	64-60
>> or	64-N
>> or	64-
>> ?
>>
> get_range will return a negative value which caused it to break out of
> the while loop on the next iteration.  I've added a check of the
> get_range return value to break immediately. See snippet.  
> If get_options is called with a bad range, 
> 64-N,65
> returns and empty array.
> 63,64-N
> returns an array with just 63.  

OK, thanks.

> 		if (res == 3) {
> 			int range_nums;
> 			range_nums = get_range((char **)&str, ints + i);
> +			if ( range_nums < 0)

no space after '('

> +					break;
> 			/* Decrement the result by one to leave out the
> 			   last number in the range.  The next iteration
> 			   will handle the upper number in the range */
> 			i += (range_nums - 1);
> 		}
> 
> Derek


-- 
~Randy

      reply	other threads:[~2006-11-01 18:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-01 16:22 [PATCH] Add get_range, allows a hyhpenated range to get_options Derek Fults
2006-11-01 16:57 ` Randy Dunlap
2006-11-01 17:29   ` Derek Fults
2006-11-01 17:36     ` Randy Dunlap
2006-11-01 18:16       ` Derek Fults
2006-11-01 18:20         ` Randy Dunlap [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4548E581.1010509@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=ak@suse.de \
    --cc=dfults@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.