* libmisc/getlong.c: Avoid implicit conversion of pointers / chars to booleans.

* libmisc/getlong.c: Add brackets.
This commit is contained in:
nekral-guest 2008-05-25 23:25:33 +00:00
parent 1ebf7842f5
commit 53bedaa4c1
2 changed files with 11 additions and 4 deletions

View File

@ -1,7 +1,13 @@
2008-05-26 Nicolas François <nicolas.francois@centraliens.net> 2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/valid.c: Avoid implicit conversion of pointers /chars to * libmisc/getlong.c: Avoid implicit conversion of pointers / chars
booleans. to booleans.
* libmisc/getlong.c: Add brackets.
2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/valid.c: Avoid implicit conversion of pointers / chars
to booleans.
* libmisc/valid.c: Add brackets. * libmisc/valid.c: Add brackets.
2008-05-26 Nicolas François <nicolas.francois@centraliens.net> 2008-05-26 Nicolas François <nicolas.francois@centraliens.net>

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007 , Nicolas François * Copyright (c) 2007 - 2008, Nicolas François
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -40,8 +40,9 @@ int getlong(const char *numstr, long int *result)
char *endptr; char *endptr;
val = strtol (numstr, &endptr, 10); val = strtol (numstr, &endptr, 10);
if (*endptr || errno == ERANGE) if (('\0' != *endptr) || (ERANGE == errno)) {
return 0; return 0;
}
*result = val; *result = val;
return 1; return 1;