ithewei 6 年之前
父节点
当前提交
ca3d595346
共有 7 个文件被更改,包括 29 次插入5 次删除
  1. 1 1
      Makefile
  2. 0 1
      h.h
  3. 24 0
      hdef.h
  4. 1 1
      hsysinfo.h
  5. 1 1
      htime.c
  6. 1 1
      hversion.h
  7. 1 0
      main.cpp.tmpl

+ 1 - 1
Makefile

@@ -100,7 +100,7 @@ else
 ifeq ($(OS), Android)
 	LDFLAGS += -Wl,-Bdynamic -lstdc++ -lm -llog
 else
-	LDFLAGS += -Wl,-Bdynamic -lstdc++ -lpthread -lm
+	LDFLAGS += -lstdc++ -lpthread -lm
 endif
 endif
 

+ 0 - 1
h.h

@@ -32,7 +32,6 @@
 
 #include "hlog.h"
 #include "hstring.h"
-#include "hmain.h"
 #include "hframe.h"
 #endif
 

+ 24 - 0
hdef.h

@@ -101,6 +101,30 @@ typedef void (*procedure_t)(void* userdata);
 #define BITGET(i, n) ((i) & (1u << (n)))
 #endif
 
+#ifndef LOWER
+#define LOWER(c)    ((c) | 0x20)
+#endif
+
+#ifndef UPPER
+#define UPPER(c)    ((c) & ~0x20)
+#endif
+
+#ifndef IS_NUM
+#define IS_NUM(c)   ((c) >= '0' && (c) <= '9')
+#endif
+
+#ifndef IS_ALPHA
+#define IS_ALPHA(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'A'))
+#endif
+
+#ifndef IS_ALPHANUM
+#define IS_ALPHANUM(c) (IS_NUM(c) || IS_ALPHA(c))
+#endif
+
+#ifndef IS_HEX
+#define IS_HEX(c) (IS_NUM(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
+#endif
+
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
 #endif

+ 1 - 1
hsysinfo.h

@@ -3,7 +3,7 @@
 
 #include "hplatform.h"
 
-#ifdef OS_UNIX
+#ifdef OS_LINUX
 #include <sys/sysinfo.h>
 #endif
 

+ 1 - 1
htime.c

@@ -19,7 +19,7 @@ inline unsigned long long gethrtime() {
     clock_gettime(CLOCK_MONOTONIC, &ts);
     return ts.tv_sec*(unsigned long long)1000000 + ts.tv_nsec / 1000;
 #else
-    return clock()* / (double)CLOCKS_PER_SEC * 1000000;
+    return clock() / (double)CLOCKS_PER_SEC * 1000000;
 #endif
 }
 

+ 1 - 1
hversion.h

@@ -19,6 +19,6 @@ inline const char* get_static_version() {
     return H_VERSION_STRING;
 }
 
-const char* get_compile_version();
+EXTERN_C const char* get_compile_version();
 
 #endif  // HW_VERSION_H_

+ 1 - 0
main.cpp.tmpl

@@ -1,4 +1,5 @@
 #include "h.h"
+#include "hmain.h"
 #include "iniparser.h"
 
 typedef struct conf_ctx_s {