mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
Merge branch 'master' of github.com:cloudwu/skynet
This commit is contained in:
2
Makefile
2
Makefile
@@ -130,7 +130,9 @@ clean :
|
|||||||
rm -f $(SKYNET_BUILD_PATH)/skynet $(CSERVICE_PATH)/*.so $(LUA_CLIB_PATH)/*.so
|
rm -f $(SKYNET_BUILD_PATH)/skynet $(CSERVICE_PATH)/*.so $(LUA_CLIB_PATH)/*.so
|
||||||
|
|
||||||
cleanall: clean
|
cleanall: clean
|
||||||
|
ifneq (,$(wildcard 3rd/jemalloc/Makefile))
|
||||||
cd 3rd/jemalloc && $(MAKE) clean
|
cd 3rd/jemalloc && $(MAKE) clean
|
||||||
|
endif
|
||||||
cd 3rd/lua && $(MAKE) clean
|
cd 3rd/lua && $(MAKE) clean
|
||||||
rm -f $(LUA_STATICLIB)
|
rm -f $(LUA_STATICLIB)
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
struct snlua {
|
struct snlua {
|
||||||
lua_State * L;
|
lua_State * L;
|
||||||
struct skynet_context * ctx;
|
struct skynet_context * ctx;
|
||||||
FILE *f;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// LUA_CACHELIB may defined in patched lua for shared proto
|
// LUA_CACHELIB may defined in patched lua for shared proto
|
||||||
@@ -144,35 +143,17 @@ snlua_init(struct snlua *l, struct skynet_context *ctx, const char * args) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
|
||||||
lalloc(void *ud, void *ptr, size_t osize, size_t nsize) {
|
|
||||||
struct snlua * l = ud;
|
|
||||||
if (l->f) {
|
|
||||||
fprintf(l->f, "%p %d %d\n", ptr, (int)osize, (int)nsize);
|
|
||||||
}
|
|
||||||
if (nsize == 0) {
|
|
||||||
skynet_free(ptr);
|
|
||||||
return NULL;
|
|
||||||
} else {
|
|
||||||
return skynet_realloc(ptr, nsize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct snlua *
|
struct snlua *
|
||||||
snlua_create(void) {
|
snlua_create(void) {
|
||||||
struct snlua * l = skynet_malloc(sizeof(*l));
|
struct snlua * l = skynet_malloc(sizeof(*l));
|
||||||
memset(l,0,sizeof(*l));
|
memset(l,0,sizeof(*l));
|
||||||
char tmp[L_tmpnam];
|
l->L = lua_newstate(skynet_lalloc, NULL);
|
||||||
l->f = fopen(tmpnam(tmp),"wb");
|
|
||||||
// printf("%s\n", tmp);
|
|
||||||
l->L = lua_newstate(lalloc, l);
|
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
snlua_release(struct snlua *l) {
|
snlua_release(struct snlua *l) {
|
||||||
lua_close(l->L);
|
lua_close(l->L);
|
||||||
fclose(l->f);
|
|
||||||
skynet_free(l);
|
skynet_free(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,6 @@ skynet_strdup(const char *str) {
|
|||||||
|
|
||||||
void *
|
void *
|
||||||
skynet_lalloc(void *ud, void *ptr, size_t osize, size_t nsize) {
|
skynet_lalloc(void *ud, void *ptr, size_t osize, size_t nsize) {
|
||||||
printf("%p osize = %d nsize = %d\n", ptr, (int)osize, (int)nsize);
|
|
||||||
if (nsize == 0) {
|
if (nsize == 0) {
|
||||||
skynet_free(ptr);
|
skynet_free(ptr);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user