diff options
| author | 杨威 <[email protected]> | 2023-06-20 16:01:35 +0800 |
|---|---|---|
| committer | 杨威 <[email protected]> | 2023-06-26 20:18:26 +0800 |
| commit | 096bbda71ea301fe6dbdc603b5cbf06bfc0d73ed (patch) | |
| tree | 7009752d8a71c4f7f4aafcce6263464d5277be80 /src/common | |
| parent | acc0ee76193f032c64dca379acad9c7256d6e13f (diff) | |
🦄 refactor(Remove obsolete code): makefile and dictator
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/Makefile | 52 | ||||
| -rw-r--r-- | src/common/sapp_mem.c | 36 |
2 files changed, 1 insertions, 87 deletions
diff --git a/src/common/Makefile b/src/common/Makefile deleted file mode 100644 index df11f31..0000000 --- a/src/common/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -#opt: OPTFLAGS = -O2
-#export OPTFLAGS
-
-CC = g++
-CCC = g++
-CFLAGS += -Wall
-CFLAGS += -fPIC -shared -D_DEFAULT_SOURCE -D_DEFAULT_SOURCE -D__DEFAULT_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H
-CFLAGS += $(OPTFLAGS)
-CFLAGS += $(PACKET_TAG_863)
-CFLAGS += -DPLATFORM_NSDPF_PAPP=1
-
-LIBPATH = ../lib
-
-H_DIR += $(INC)
-H_DIR += -I../../include
-H_DIR += -I../../include/private
-H_DIR += -I../../include/public
-H_DIR += -I../../include/support
-
-H_DIR += -I/opt/MESA/include
-H_DIR += -I/opt/MESA/include/MESA
-
-TARGET = libcommon.a
-
-OBJS= net_common.o stream_addr_inet.o linux_kernel_jhash.o sapp_log.o
-
-ifeq ($(IIEFD_DUAL_STACK), $(YES))
-CFLAGS += -g -DIIEFD_DUAL_STACK=1
-endif
-
-ifeq ($(USE_MEM_POOL), 1)
-CFLAGS += -DUSE_MEMPOOL=1
-endif
-
-
-all: $(TARGET)
-
-$(TARGET): $(OBJS)
- rm -f $@ ;ar -r $@ $^;
- cp $(TARGET) $(LIBPATH)
-
-.c.o:
- $(CC) -c $(CFLAGS) -I. $(H_DIR) $<
-
-.cpp.o:
- $(CCC) -c $(CFLAGS) -I. $(H_DIR) $<
-
-clean:
- rm -f *.o $(TARGET) *~
-
-opt:
- $(MAKE) all
diff --git a/src/common/sapp_mem.c b/src/common/sapp_mem.c index 465e58c..e921de0 100644 --- a/src/common/sapp_mem.c +++ b/src/common/sapp_mem.c @@ -6,11 +6,7 @@ extern "C" { #endif -extern void *__dictator_malloc(int t_seq,size_t size); -extern void __dictator_free(int t_seq,void*p); -/* �˴�����ʹ��һ��ȫ�ֱ���, Ϊ���ж��Ƿ�����dictator, ����Ԥ�ȷ����ڴ� */ -int g_sapp_mem_use_dictator = 1; int g_sapp_global_mem_used_block = 0; int g_sapp_global_mem_used_bytes = 0; @@ -61,15 +57,7 @@ void *sapp_mem_malloc(sapp_mem_type_t type, int thread_seq, int size) sapp_private_mem_t *mhdr; sapp_mem_used_stat_t *mem_used_stat; -#if USE_MEMPOOL - if(g_sapp_mem_use_dictator){ - ptr = __dictator_malloc(thread_seq, size+sizeof(sapp_private_mem_t)); - }else{ - ptr = (char *)malloc(size+sizeof(sapp_private_mem_t)); - } -#else ptr = (char *)malloc(size+sizeof(sapp_private_mem_t)); -#endif mhdr = (sapp_private_mem_t *)ptr; @@ -99,17 +87,7 @@ void *sapp_mem_calloc(sapp_mem_type_t type, int thread_seq, int size) char *ptr; sapp_private_mem_t *mhdr; sapp_mem_used_stat_t *mem_used_stat; - -#if USE_MEMPOOL - if(g_sapp_mem_use_dictator){ - ptr = __dictator_malloc(thread_seq, size+sizeof(sapp_private_mem_t)); - memset(ptr, 0, size+sizeof(sapp_private_mem_t)); - }else{ - ptr = (char *)calloc(1, size+sizeof(sapp_private_mem_t)); - } -#else ptr = (char *)calloc(1, size+sizeof(sapp_private_mem_t)); -#endif mhdr = (sapp_private_mem_t *)ptr; @@ -156,19 +134,7 @@ void sapp_mem_free(sapp_mem_type_t type, int thread_seq, void *data) mem_used_stat->mem_used_block[SAPP_MEM_DYN_MEM_HDR]--; mem_used_stat->mem_used_bytes[SAPP_MEM_DYN_MEM_HDR] -= sizeof(sapp_private_mem_t); - - -#if USE_MEMPOOL - if(g_sapp_mem_use_dictator){ - __dictator_free(thread_seq, (void *)mhdr); - }else{ - free((void *)mhdr); - } -#else - free((void *)mhdr); -#endif - - + free((void *)mhdr); } void *sapp_mem_realloc(sapp_mem_type_t type, int thread_seq, void *old_ptr, int size) |
