diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-05-27 22:08:24 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-05-27 22:08:24 +0800 |
commit | cfeb386b61341ef5dd85a5320f5854e724e2bdf6 (patch) | |
tree | 7a935d79f8c788ca7696279b1a3aa1f519e551fd /include | |
parent | a8ac9d593f193d06a2dff50bb91f81bfee6b9a94 (diff) | |
download | pttbbs-cfeb386b61341ef5dd85a5320f5854e724e2bdf6.tar pttbbs-cfeb386b61341ef5dd85a5320f5854e724e2bdf6.tar.gz pttbbs-cfeb386b61341ef5dd85a5320f5854e724e2bdf6.tar.bz2 pttbbs-cfeb386b61341ef5dd85a5320f5854e724e2bdf6.tar.lz pttbbs-cfeb386b61341ef5dd85a5320f5854e724e2bdf6.tar.xz pttbbs-cfeb386b61341ef5dd85a5320f5854e724e2bdf6.tar.zst pttbbs-cfeb386b61341ef5dd85a5320f5854e724e2bdf6.zip |
* rewrite namecomplete2. Avoid small allocation, e.g. linked list,
since some allocator, e.g. dielibc, may not return memory to OS.
This saves about 1gb memory for ptt.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3517 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'include')
-rw-r--r-- | include/proto.h | 6 | ||||
-rw-r--r-- | include/pttstruct.h | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/proto.h b/include/proto.h index 12700e29..1d482e55 100644 --- a/include/proto.h +++ b/include/proto.h @@ -412,6 +412,12 @@ typedef int (*gnc_comp_func)(int, const char*, int); typedef int (*gnc_perm_func)(int); typedef char* (*gnc_getname_func)(int); +extern void NameList_init(struct NameList *self); +extern void NameList_delete(struct NameList *self); +extern void NameList_clear(struct NameList *self); +extern void NameList_add(struct NameList *self, const char *name); +extern void namecomplete2(struct NameList *namelist, const char *prompt, char *data); + void usercomplete(const char *prompt, char *data); void namecomplete(const char *prompt, char *data); void AddNameList(const char *name); diff --git a/include/pttstruct.h b/include/pttstruct.h index 67fa00cf..64aac0ac 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -652,6 +652,12 @@ typedef struct word_t { struct word_t *next; } word_t; +struct NameList { + int size; + int capacity; + char (*base)[IDLEN+1]; +}; + typedef struct commands_t { int (*cmdfunc)(); int level; |