Skip to content

Commit 50c8626

Browse files
author
Jarry
committed
add interpeter for c
1 parent 232b1f1 commit 50c8626

File tree

17 files changed

+994
-19
lines changed

17 files changed

+994
-19
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"string": "c",
3535
"string_view": "c",
3636
"iosfwd": "c",
37-
"locale": "c"
37+
"locale": "c",
38+
"*.tcc": "c"
3839
}
3940
}

flyweight-pattern/c/src/flyweight_factory.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ Flyweight *get_factory(char *name)
1414
{
1515

1616
// 定义公共map用作共享池子,全局共用
17+
int number = 100;
1718
if (flyweight_factory_member_pool == NULL)
1819
{
19-
flyweight_factory_member_pool = (Flyweight **)calloc(100, sizeof(Flyweight));
20+
flyweight_factory_member_pool = (Flyweight **)calloc(number, sizeof(Flyweight));
2021
}
2122
if (flyweight_factory_name_pool == NULL)
2223
{
23-
flyweight_factory_name_pool = (char **)calloc(100, sizeof(char));
24+
flyweight_factory_name_pool = (char **)calloc(number, sizeof(char));
2425
}
2526

2627
Flyweight **flyweight_pool = flyweight_factory_member_pool;

0 commit comments

Comments
 (0)