From: Derek Fults <dfults@sgi.com>
To: Randy Dunlap <randy.dunlap@oracle.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 12:16:04 -0600 [thread overview]
Message-ID: <1162404964.9524.524.camel@lnx-dfults.americas.sgi.com> (raw)
In-Reply-To: <4548DB0C.3050601@oracle.com>
> 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.
if (res == 3) {
int range_nums;
range_nums = get_range((char **)&str, ints + i);
+ if ( range_nums < 0)
+ 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
next prev parent reply other threads:[~2006-11-01 18:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-01 16:22 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 [this message]
2006-11-01 18:20 ` Randy Dunlap
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=1162404964.9524.524.camel@lnx-dfults.americas.sgi.com \
--to=dfults@sgi.com \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=randy.dunlap@oracle.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®