...G...... [ZBXNEXT-1078] improved error detection and coding style

   - pointer 'p1' renamed to more meaningful 'p_unit',
   - explicit type conversions added to prevent compiler warnings,
   - added error check for sscanf(),
   - added detection of a valid memory type which is not supported on a particular kernel.