[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/app/zte_ping/util.h b/ap/app/zte_ping/util.h
new file mode 100755
index 0000000..42f81b0
--- /dev/null
+++ b/ap/app/zte_ping/util.h
@@ -0,0 +1,58 @@
+
+#ifndef UTIL_H
+#define UTIL_H
+
+void warn(const char *inMessage, const char *inFile, int inLine);
+void warn_errno(const char *inMessage, const char *inFile, int inLine);
+
+#define FAIL(cond, msg) \
+ do { \
+ if (cond) { \
+ warn(msg, __FILE__, __LINE__); \
+ exit(1); \
+ } \
+ } while(0)
+
+#define FAIL_errno(cond, msg) \
+ do { \
+ if (cond) { \
+ warn_errno(msg, __FILE__, __LINE__); \
+ exit(1); \
+ } \
+ } while( 0 )
+
+#define WARN( cond, msg ) \
+ do { \
+ if ( cond ) { \
+ warn( msg, __FILE__, __LINE__ ); \
+ } \
+ } while( 0 )
+
+#define WARN_errno( cond, msg ) \
+ do { \
+ if ( cond ) { \
+ warn_errno( msg, __FILE__, __LINE__ ); \
+ } \
+ } while( 0 )
+
+/* -------------------------------------------------------------------
+ * delete macro
+ * ------------------------------------------------------------------- */
+/*
+#define DELETE_PTR( ptr ) \
+ do { \
+ if ( ptr != NULL ) { \
+ delete ptr; \
+ ptr = NULL; \
+ } \
+ } while( false )
+
+#define DELETE_ARRAY( ptr ) \
+ do { \
+ if ( ptr != NULL ) { \
+ delete [] ptr; \
+ ptr = NULL; \
+ } \
+ } while( false )
+*/
+#endif /* UTIL_H */