mariadb/dbug/factorial.c
iggy@amd64.(none) 79e434bc67 Bug#26243 mysql command line crash after control-c
- Backported the 5.1 DBUG to 5.0.
- Avoid memory cleanup race on Windows client for CTRL-C
2008-03-28 14:02:27 -04:00

27 lines
453 B
C

#ifdef DBUG_OFF /* We are testing dbug */
int factorial(register int value) {
if(value > 1) {
value *= factorial(value-1);
}
return value;
}
#else
#include <my_global.h>
int factorial (
register int value)
{
DBUG_ENTER ("factorial");
DBUG_PRINT ("find", ("find %d factorial", value));
if (value > 1) {
value *= factorial (value - 1);
}
DBUG_PRINT ("result", ("result is %d", value));
DBUG_RETURN (value);
}
#endif