|
| <prev next> |
current miscutil.c,1.55,1.56: msg#00000web.privoxy.cvs
Update of /cvsroot/ijbswa/current In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv31832 Modified Files: miscutil.c Log Message: Some sanity checks for pick_from_range(). Index: miscutil.c =================================================================== RCS file: /cvsroot/ijbswa/current/miscutil.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- miscutil.c 3 Nov 2007 17:34:49 -0000 1.55 +++ miscutil.c 1 Dec 2007 12:59:05 -0000 1.56 @@ -44,6 +44,9 @@ * * Revisions : * $Log$ + * Revision 1.56 2007/12/01 12:59:05 fabiankeil + * Some sanity checks for pick_from_range(). + * * Revision 1.55 2007/11/03 17:34:49 fabiankeil * Log the "weak randomization factor" warning only * once for mingw32 and provide some more details. @@ -1092,6 +1095,12 @@ long int pick_from_range(long int range) { long int number; + + assert(range != 0); + assert(range > 0); + + if (range <= 0) return 0; + #ifdef HAVE_RANDOM number = random() % range + 1; #elif defined(FEATURE_PTHREAD) @@ -1124,7 +1133,7 @@ #endif /* (def HAVE_RANDOM) */ - return (number); + return number; } ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Next by Date: | current parsers.c,1.115,1.116: 00000, noreply |
|---|---|
| Next by Thread: | current parsers.c,1.115,1.116: 00000, noreply |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |