Replace common pattern by new LIMIT_TO()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2013-01-14 22:34:05 +01:00
parent aa870f5d91
commit 726b9380d1
11 changed files with 73 additions and 162 deletions

View file

@ -30,6 +30,7 @@
* David Muir Sharnoff
* Karl Hagen
* Steve McClure, 1998
* Markus Armbruster, 2010-2013
*/
#include <config.h>
@ -64,10 +65,7 @@ setres(void)
if (!p || !*p)
return RET_SYN;
amt = atoi(p);
if (amt > 100)
amt = 100;
if (amt < 0)
amt = 0;
amt = LIMIT_TO(amt, 0, 100);
if (!check_sect_ok(&sect))
return RET_FAIL;
switch (char0) {