Macros & code correction

*	Macros for initialize allocation checking;
*	First we check all errors and then doing calculations
*	Static variables and functions
*	Check second initialization
*	Delete several levels of code
*	unsigned long = 0;
Simplify get_alloc() conditions

Simplify get_alloc() conditions, added comments for better understanding