Skip to content

Commit d167d8f

Browse files
committed
fixed fiber's errors;
add feature in some modules.
1 parent eca0d39 commit d167d8f

40 files changed

+502
-532
lines changed

changes.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
�޸���ʷ�б���
22
------------------------------------------------------------------------
3+
106) 2017.3.30
4+
106.1) compile: ��������ͷ�ļ��к궨�壬������ͬ�ı��뷽ʽ
5+
6+
105) 2017.3.26
7+
105.1) cmake �� vs ���������б���ͨ��
8+
39
104) 2017.3.25
410
104.1) ������������
511
lib_acl.a --> libacl.a

lib_acl/CMakeLists.txt

Lines changed: 52 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,57 +9,30 @@ if (${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
99
message(FATAL_ERROR "Please into another dir to build!")
1010
endif()
1111

12-
add_definitions(
13-
"-W"
14-
"-fPIC"
15-
"-Wall"
16-
"-Werror"
17-
"-Wshadow"
18-
"-Wpointer-arith"
19-
"-Waggregate-return"
20-
"-Wmissing-prototypes"
21-
"-D_REENTRANT"
22-
"-D_USE_FAST_MACRO"
23-
"-DACL_WRITEABLE_CHECK"
24-
"-Wno-long-long"
25-
"-Wuninitialized"
26-
"-D_POSIX_PTHREAD_SEMANTICS"
27-
"-DACL_PREPARE_COMPILE"
28-
"-Wno-invalid-source-encoding"
29-
"-Wstrict-prototypes"
30-
)
31-
32-
if (CMAKE_BUILD_TYPE STREQUAL "")
33-
set(CMAKE_BUILD_TYPE "DEBUG")
34-
else()
35-
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
36-
endif()
37-
38-
if (CMAKE_BUILD_TYPE STREQUAL "RELEASE")
39-
add_definitions("-O3")
40-
else()
41-
add_definitions("-g")
42-
endif()
43-
4412
#string(TOUPPER ${CMAKE_SYSTEM_NAME} CMAKE_SYSTEM_NAME)
4513
if (CMAKE_SYSTEM_NAME MATCHES "Android")
4614
add_definitions("-DANDROID")
15+
set(UNIX_OS true)
4716
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
17+
set(UNIX_OS true)
4818
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
19+
set(UNIX_OS true)
20+
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
21+
set(WIN_OS true)
4922
else()
5023
message(FATAL_ERROR "unknown CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}")
5124
endif()
5225

5326
##############################################################################
5427

55-
set(src ${CMAKE_CURRENT_SOURCE_DIR}/src)
56-
5728
include_directories(
5829
${CMAKE_CURRENT_SOURCE_DIR}
5930
${CMAKE_CURRENT_SOURCE_DIR}/include
6031
)
6132

33+
set(src ${CMAKE_CURRENT_SOURCE_DIR}/src)
6234
set(sources
35+
${src}
6336
${src}/stdlib
6437
${src}/stdlib/debug
6538
${src}/stdlib/memory
@@ -100,6 +73,47 @@ foreach(iter ${sources})
10073
aux_source_directory(${iter} lib_src)
10174
endforeach()
10275

76+
##############################################################################
77+
78+
if (CMAKE_BUILD_TYPE STREQUAL "")
79+
set(CMAKE_BUILD_TYPE "DEBUG")
80+
else()
81+
string(TOUPPER CMAKE_BUILD_TYPE CMAKE_BUILD_TYPE)
82+
endif()
83+
84+
if (${UNIX_OS})
85+
add_definitions(
86+
"-W"
87+
"-fPIC"
88+
"-Wall"
89+
"-Werror"
90+
"-Wshadow"
91+
"-Wpointer-arith"
92+
"-Waggregate-return"
93+
"-Wmissing-prototypes"
94+
"-D_REENTRANT"
95+
"-D_USE_FAST_MACRO"
96+
"-DACL_WRITEABLE_CHECK"
97+
"-Wno-long-long"
98+
"-Wuninitialized"
99+
"-D_POSIX_PTHREAD_SEMANTICS"
100+
"-DACL_PREPARE_COMPILE"
101+
"-Wno-invalid-source-encoding"
102+
"-Wstrict-prototypes"
103+
)
104+
105+
if (CMAKE_BUILD_TYPE STREQUAL "RELEASE")
106+
add_definitions("-O3")
107+
else()
108+
add_definitions("-g")
109+
endif()
110+
elseif (${WIN_OS})
111+
add_definitions(
112+
"-Yc"
113+
"-DACL_WRITEABLE_CHECK"
114+
"-DACL_PREPARE_COMPILE")
115+
endif()
116+
103117
if (CMAKE_SYSTEM_NAME MATCHES "Android")
104118
set(CMAKE_SHARED_LINKER_FLAGS "-shared")
105119
else()
@@ -109,6 +123,10 @@ else()
109123
add_library(acl_static STATIC ${lib_src})
110124
SET_TARGET_PROPERTIES(acl_static PROPERTIES OUTPUT_NAME "acl")
111125

126+
if (${WIN_OS})
127+
set(CMAKE_SHARED_LINKER_FLAGS "/DYNAMICBASE ws2_32.lib IPHlpApi.lib")
128+
endif()
129+
112130
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
113131
endif()
114132

lib_acl/acl.xcodeproj/project.pbxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,7 +1934,7 @@
19341934
GCC_WARN_UNUSED_VARIABLE = YES;
19351935
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
19361936
MTL_ENABLE_DEBUG_INFO = YES;
1937-
ONLY_ACTIVE_ARCH = YES;
1937+
ONLY_ACTIVE_ARCH = NO;
19381938
SDKROOT = iphoneos;
19391939
};
19401940
name = Debug;
@@ -1972,6 +1972,7 @@
19721972
GCC_WARN_UNUSED_VARIABLE = YES;
19731973
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
19741974
MTL_ENABLE_DEBUG_INFO = NO;
1975+
ONLY_ACTIVE_ARCH = NO;
19751976
SDKROOT = iphoneos;
19761977
VALIDATE_PRODUCT = YES;
19771978
};

lib_acl/changes.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
�޸���ʷ�б���
22

3+
577) 2017.3.30
4+
577.1) feature: json ������ڴ��� json �ַ���ʱĬ�ϲ��Զ����ӿո񣬵�����������
5+
���ò����Ա����Զ����ӿո�Ӷ�ʹ json �ַ������ɶ�
6+
37
576) 2017.3.11
48
576.1) bugfix: acl_scan_dir.c �к��� acl_scan_dir_push �� windows �´������⣬
59
�������ѭ��

lib_acl/include/json/acl_json.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ struct ACL_JSON {
8686
int finish; /**< 是否分析结束 */
8787
unsigned flag; /**< 标志位 */
8888
#define ACL_JSON_FLAG_PART_WORD (1 << 0) /**< 是否兼容半个汉字 */
89+
#define ACL_JSON_FLAG_ADD_SPACE (1 << 1) /**< 创建 json 时是否添空格 */
8990

9091
/* public: for acl_iterator, 通过 acl_foreach 可以列出所有子节点 */
9192

lib_acl/include/stdlib/acl_define_win32.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,21 @@
4040
abort(); \
4141
} while(0)
4242

43-
# ifdef ACL_DLL
44-
# ifdef ACL_EXPORTS
43+
#ifdef ACL_LIB
44+
# ifndef ACL_API
45+
# define ACL_API
46+
# endif
47+
#elif defined(ACL_DLL) || defined(_WINDLL)
48+
# if defined(ACL_EXPORTS) || defined(acl_EXPORTS)
49+
# ifndef ACL_API
4550
# define ACL_API __declspec(dllexport)
46-
# else
47-
# define ACL_API __declspec(dllimport)
4851
# endif
49-
# else
50-
# define ACL_API
52+
# elif !defined(ACL_API)
53+
# define ACL_API __declspec(dllimport)
5154
# endif
55+
#elif !defined(ACL_API)
56+
# define ACL_API
57+
#endif
5258

5359
/**
5460
* see WINSOCK2.H, 用户需要预先定义此值,因其默认值为64,此外,该值不能设得太大,

lib_acl/include/stdlib/acl_mymalloc.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ extern "C" {
7070
* @param _ptr_ {void*} 动态内存地址
7171
*/
7272
#define acl_myfree(_ptr_) do { \
73-
acl_free_glue(__FILE__, __LINE__, (_ptr_)); \
74-
(_ptr_) = NULL; \
73+
if (_ptr_) { \
74+
acl_free_glue(__FILE__, __LINE__, (_ptr_)); \
75+
(_ptr_) = NULL; \
76+
} \
7577
} while (0)
7678

7779
/**
@@ -84,4 +86,3 @@ extern "C" {
8486
#endif
8587

8688
#endif
87-

lib_acl/src/json/acl_json_util.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,20 @@ void acl_json_building(ACL_JSON *json, size_t length,
303303

304304
node = (ACL_JSON_NODE*) iter.data;
305305
prev = acl_json_node_prev(node);
306-
if (prev != NULL)
307-
acl_vstring_strcat(buf, ", ");
306+
if (prev != NULL) {
307+
if ((json->flag & ACL_JSON_FLAG_ADD_SPACE))
308+
acl_vstring_strcat(buf, ", ");
309+
else
310+
acl_vstring_strcat(buf, ",");
311+
}
308312

309313
/* 只有当标签的对应值为 JSON 对象或数组对象时 tag_node 非空 */
310314
if (node->tag_node != NULL) {
311315
if (LEN(node->ltag) > 0) {
312316
json_escape_append(buf, STR(node->ltag));
313317
ACL_VSTRING_ADDCH(buf, ':');
314-
ACL_VSTRING_ADDCH(buf, ' ');
318+
if ((json->flag & ACL_JSON_FLAG_ADD_SPACE))
319+
ACL_VSTRING_ADDCH(buf, ' ');
315320
}
316321

317322
/* '{' or '[' */
@@ -323,7 +328,8 @@ void acl_json_building(ACL_JSON *json, size_t length,
323328
else if (LEN(node->ltag) > 0) {
324329
json_escape_append(buf, STR(node->ltag));
325330
ACL_VSTRING_ADDCH(buf, ':');
326-
ACL_VSTRING_ADDCH(buf, ' ');
331+
if ((json->flag & ACL_JSON_FLAG_ADD_SPACE))
332+
ACL_VSTRING_ADDCH(buf, ' ');
327333

328334
switch (node->type & ~ACL_JSON_T_LEAF) {
329335
case ACL_JSON_T_NULL:
@@ -430,15 +436,20 @@ ACL_VSTRING *acl_json_build(ACL_JSON *json, ACL_VSTRING *buf)
430436
acl_foreach(iter, json) {
431437
node = (ACL_JSON_NODE*) iter.data;
432438
prev = acl_json_node_prev(node);
433-
if (prev != NULL)
434-
acl_vstring_strcat(buf, ", ");
439+
if (prev != NULL) {
440+
if ((json->flag & ACL_JSON_FLAG_ADD_SPACE))
441+
acl_vstring_strcat(buf, ", ");
442+
else
443+
acl_vstring_strcat(buf, ",");
444+
}
435445

436446
/* 只有当标签的对应值为 JSON 对象或数组对象时 tag_node 非空 */
437447
if (node->tag_node != NULL) {
438448
if (LEN(node->ltag) > 0) {
439449
json_escape_append(buf, STR(node->ltag));
440450
ACL_VSTRING_ADDCH(buf, ':');
441-
ACL_VSTRING_ADDCH(buf, ' ');
451+
if ((json->flag & ACL_JSON_FLAG_ADD_SPACE))
452+
ACL_VSTRING_ADDCH(buf, ' ');
442453
}
443454

444455
/* '{' or '[' */
@@ -450,7 +461,8 @@ ACL_VSTRING *acl_json_build(ACL_JSON *json, ACL_VSTRING *buf)
450461
else if (LEN(node->ltag) > 0) {
451462
json_escape_append(buf, STR(node->ltag));
452463
ACL_VSTRING_ADDCH(buf, ':');
453-
ACL_VSTRING_ADDCH(buf, ' ');
464+
if ((json->flag & ACL_JSON_FLAG_ADD_SPACE))
465+
ACL_VSTRING_ADDCH(buf, ' ');
454466

455467
switch (node->type & ~ACL_JSON_T_LEAF) {
456468
case ACL_JSON_T_NULL:

lib_acl/src/master/framework/master_warning.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "StdAfx.h"
12
#include "stdlib/acl_define.h"
23

34
#ifdef ACL_UNIX

lib_acl/src/stdlib/sys/gettimeofday.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
# else
2828
# define EPOCHFILETIME (116444736000000000LL)
2929
# endif
30-
30+
/*
3131
#ifndef ACL_DLL
3232
int _daylight;
3333
long _timezone;
3434
#endif
35-
35+
*/
3636
static void dummy(void *ptr acl_unused)
3737
{
3838

0 commit comments

Comments
 (0)