mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +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
|
||||
|
||||
cleanall: clean
|
||||
ifneq (,$(wildcard 3rd/jemalloc/Makefile))
|
||||
cd 3rd/jemalloc && $(MAKE) clean
|
||||
endif
|
||||
cd 3rd/lua && $(MAKE) clean
|
||||
rm -f $(LUA_STATICLIB)
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
struct snlua {
|
||||
lua_State * L;
|
||||
struct skynet_context * ctx;
|
||||
FILE *f;
|
||||
};
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
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 *
|
||||
snlua_create(void) {
|
||||
struct snlua * l = skynet_malloc(sizeof(*l));
|
||||
memset(l,0,sizeof(*l));
|
||||
char tmp[L_tmpnam];
|
||||
l->f = fopen(tmpnam(tmp),"wb");
|
||||
// printf("%s\n", tmp);
|
||||
l->L = lua_newstate(lalloc, l);
|
||||
l->L = lua_newstate(skynet_lalloc, NULL);
|
||||
return l;
|
||||
}
|
||||
|
||||
void
|
||||
snlua_release(struct snlua *l) {
|
||||
lua_close(l->L);
|
||||
fclose(l->f);
|
||||
skynet_free(l);
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +218,6 @@ skynet_strdup(const char *str) {
|
||||
|
||||
void *
|
||||
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) {
|
||||
skynet_free(ptr);
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user