renamed ase_memchr/ase_memrchr to ase_membyte/ase_memrbyte
This commit is contained in:
		| @ -1,9 +1,10 @@ | |||||||
| /* | /* | ||||||
|  * $Id: awk.c 325 2008-08-13 14:22:29Z baconevi $ |  * $Id: awk.c 329 2008-08-16 14:08:53Z baconevi $ | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include <ase/awk/awk.h> | #include <ase/awk/awk.h> | ||||||
| #include <ase/cmn/sll.h> | #include <ase/cmn/sll.h> | ||||||
|  | #include <ase/cmn/mem.h> | ||||||
|  |  | ||||||
| #include <ase/utl/helper.h> | #include <ase/utl/helper.h> | ||||||
| #include <ase/utl/getopt.h> | #include <ase/utl/getopt.h> | ||||||
| @ -1288,7 +1289,7 @@ static int awk_main (int argc, ase_char_t* argv[]) | |||||||
|  |  | ||||||
| 	ase_sll_t* sf; | 	ase_sll_t* sf; | ||||||
|  |  | ||||||
| 	sf = ase_sll_open (ASE_GETMMGR()); | 	sf = ase_sll_open (ASE_MMGR_GET()); | ||||||
| 	if (sf == ASE_NULL) | 	if (sf == ASE_NULL) | ||||||
| 	{ | 	{ | ||||||
| 		out_of_memory (); | 		out_of_memory (); | ||||||
|  | |||||||
| @ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
|  * $Id: helper.h 231 2008-06-28 08:37:09Z baconevi $ |  * $Id: helper.h 329 2008-08-16 14:08:53Z baconevi $ | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #ifndef _ASE_UTL_HELPER_H_ | #ifndef _ASE_UTL_HELPER_H_ | ||||||
| @ -8,9 +8,6 @@ | |||||||
| #include <ase/types.h> | #include <ase/types.h> | ||||||
| #include <ase/macros.h> | #include <ase/macros.h> | ||||||
|  |  | ||||||
| #define ASE_GETMMGR()  (ase_mmgr) |  | ||||||
| #define ASE_SETMMGR(m) ((ase_mmgr) = (m)) |  | ||||||
|  |  | ||||||
| #define ASE_GETCCLS()  (ase_ccls) | #define ASE_GETCCLS()  (ase_ccls) | ||||||
| #define ASE_SETCCLS(c) ((ase_ccls) = (c)) | #define ASE_SETCCLS(c) ((ase_ccls) = (c)) | ||||||
|  |  | ||||||
| @ -18,7 +15,6 @@ | |||||||
| extern "C" { | extern "C" { | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| extern ase_mmgr_t* ase_mmgr; |  | ||||||
| extern ase_ccls_t* ase_ccls; | extern ase_ccls_t* ase_ccls; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
|  | |||||||
| @ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
|  * $Id: jni.c 271 2008-07-20 12:42:39Z baconevi $ |  * $Id: jni.c 329 2008-08-16 14:08:53Z baconevi $ | ||||||
|  * |  * | ||||||
|  * {License} |  * {License} | ||||||
|  */ |  */ | ||||||
| @ -327,7 +327,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_open (JNIEnv* env, jobject obj) | |||||||
| 	#endif | 	#endif | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| 	awk = ase_awk_open (ASE_GETMMGR(), ASE_SIZEOF(awk_data_t)); | 	awk = ase_awk_open (ASE_MMGR_GET(), ASE_SIZEOF(awk_data_t)); | ||||||
| 	if (awk == ASE_NULL) | 	if (awk == ASE_NULL) | ||||||
| 	{ | 	{ | ||||||
| 		THROW_NOMEM_EXCEPTION (env); | 		THROW_NOMEM_EXCEPTION (env); | ||||||
|  | |||||||
| @ -45,7 +45,7 @@ ase_awk_t* ase_awk_openstd (void) | |||||||
| 	ase_awk_t* awk; | 	ase_awk_t* awk; | ||||||
| 	ext_t* ext; | 	ext_t* ext; | ||||||
|  |  | ||||||
| 	awk = ase_awk_open (ASE_GETMMGR(), ASE_SIZEOF(ext_t), ASE_NULL); | 	awk = ase_awk_open (ASE_MMGR_GET(), ASE_SIZEOF(ext_t), ASE_NULL); | ||||||
| 	ase_awk_setccls (awk, ASE_GETCCLS()); | 	ase_awk_setccls (awk, ASE_GETCCLS()); | ||||||
|  |  | ||||||
| 	ext = (ext_t*) ase_awk_getextension (awk); | 	ext = (ext_t*) ase_awk_getextension (awk); | ||||||
|  | |||||||
| @ -1,10 +1,11 @@ | |||||||
| /* | /* | ||||||
|  * $Id: mem.c 177 2008-04-26 04:58:10Z baconevi $ |  * $Id: mem.c 329 2008-08-16 14:08:53Z baconevi $ | ||||||
|  * |  * | ||||||
|  * {License} |  * {License} | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include <ase/cmn/mem.h> | #include <ase/cmn/mem.h> | ||||||
|  | #include <stdlib.h> | ||||||
|  |  | ||||||
| #if defined(__SPU__) | #if defined(__SPU__) | ||||||
| #include <spu_intrinsics.h> | #include <spu_intrinsics.h> | ||||||
| @ -399,3 +400,28 @@ void* ase_memrmem (const void* hs, ase_size_t hl, const void* nd, ase_size_t nl) | |||||||
|  |  | ||||||
| 	return ASE_NULL; | 	return ASE_NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void* mmgr_malloc (void* custom, ase_size_t n) | ||||||
|  | { | ||||||
|  |         return malloc (n); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void* mmgr_realloc (void* custom, void* ptr, ase_size_t n) | ||||||
|  | { | ||||||
|  |         return realloc (ptr, n); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void mmgr_free (void* custom, void* ptr) | ||||||
|  | { | ||||||
|  |         free (ptr); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static ase_mmgr_t mmgr = | ||||||
|  | { | ||||||
|  | 	mmgr_malloc, | ||||||
|  | 	mmgr_realloc, | ||||||
|  | 	mmgr_free, | ||||||
|  | 	ASE_NULL | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | ase_mmgr_t* ase_mmgr = &mmgr; | ||||||
|  | |||||||
| @ -7,19 +7,28 @@ | |||||||
| #ifndef _ASE_LIB_CMN_MEM_H_ | #ifndef _ASE_LIB_CMN_MEM_H_ | ||||||
| #define _ASE_LIB_CMN_MEM_H_ | #define _ASE_LIB_CMN_MEM_H_ | ||||||
|  |  | ||||||
|  | #include <ase/cmn/mem.h> | ||||||
|  |  | ||||||
| #ifdef USE_STDC | #ifdef USE_STDC | ||||||
|  |  | ||||||
| #include <string.h> | #include <string.h> | ||||||
| #define ASE_MEMCPY(dst,src,len) memcpy(dst,src,len) | #define ASE_MEMCPY(dst,src,len) memcpy(dst,src,len) | ||||||
| #define ASE_MEMCMP(p1,p2,len) memcmp(p1,p2,len) | #define ASE_MEMCMP(p1,p2,len) memcmp(p1,p2,len) | ||||||
| #define ASE_MEMSET(dst,val,len) memset(dst,val,len) | #define ASE_MEMSET(dst,val,len) memset(dst,val,len) | ||||||
|  | #define ASE_MEMBYTE(s,val,len) memchr(s,val,len) | ||||||
|  | #define ASE_MEMRBYTE(s,val,len) memrchr(s,val,len) | ||||||
|  | #define ASE_MEMMEM(hs,hl,nd,nl) memmem(hs,hl,nd,nl) | ||||||
|  | #define ASE_MEMRMEM(hs,hl,nd,nl) memrmem(hs,hl,nd,nl) | ||||||
|  |  | ||||||
| #else | #else | ||||||
|  |  | ||||||
| #include <ase/cmn/mem.h> |  | ||||||
| #define ASE_MEMCPY(dst,src,len) ase_memcpy(dst,src,len) | #define ASE_MEMCPY(dst,src,len) ase_memcpy(dst,src,len) | ||||||
| #define ASE_MEMCMP(p1,p2,len) ase_memcmp(p1,p2,len) | #define ASE_MEMCMP(p1,p2,len) ase_memcmp(p1,p2,len) | ||||||
| #define ASE_MEMSET(dst,val,len) ase_memset(dst,val,len) | #define ASE_MEMSET(dst,val,len) ase_memset(dst,val,len) | ||||||
|  | #define ASE_MEMBYTE(s,val,len) ase_membyte(s,val,len) | ||||||
|  | #define ASE_MEMRBYTE(s,val,len) ase_memrbyte(s,val,len) | ||||||
|  | #define ASE_MEMMEM(hs,hl,nd,nl) ase_memmem(hs,hl,nd,nl) | ||||||
|  | #define ASE_MEMRMEM(hs,hl,nd,nl) ase_memrmem(hs,hl,nd,nl) | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | |||||||
| @ -13,15 +13,21 @@ void* ase_sll_copyinline (ase_sll_t* sll, void* dptr, ase_size_t dlen) | |||||||
| 	return ASE_NULL; | 	return ASE_NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| ase_sll_t* ase_sll_open (ase_mmgr_t* mmgr) | ase_sll_t* ase_sll_open () | ||||||
| { | { | ||||||
| 	return ase_sll_openx (mmgr, 0, ASE_NULL); | 	return ase_sll_openx (mmgr, 0, ASE_NULL); | ||||||
| } | } | ||||||
|  |  | ||||||
| ase_sll_t* ase_sll_openx (ase_mmgr_t* mmgr, ase_size_t extension, ase_fuser_t fuser) | ase_sll_openm (ase_mmgr_t* mmgr); | ||||||
|  | ase_sll_openx (ase_size_t extension, ase_fuser_t fuser); | ||||||
|  |  | ||||||
|  | ase_sll_t* ase_sll_openf ( | ||||||
|  | 	ase_mmgr_t* mmgr, ase_size_t extension, ase_fuser_t fuser) | ||||||
| { | { | ||||||
| 	ase_sll_t* sll; | 	ase_sll_t* sll; | ||||||
|  |  | ||||||
|  | 	if (mmgr == ASE_NULL) mmgr = ASE_MMGR_GET (); | ||||||
|  |  | ||||||
| 	sll = ASE_MALLOC (mmgr, ASE_SIZEOF(ase_sll_t) + extension); | 	sll = ASE_MALLOC (mmgr, ASE_SIZEOF(ase_sll_t) + extension); | ||||||
| 	if (sll == ASE_NULL) return ASE_NULL; | 	if (sll == ASE_NULL) return ASE_NULL; | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,26 +1,10 @@ | |||||||
|  |  | ||||||
| /* | /* | ||||||
|  * $Id: helper.c 231 2008-06-28 08:37:09Z baconevi $ |  * $Id: helper.c 329 2008-08-16 14:08:53Z baconevi $ | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include <ase/utl/helper.h> | #include <ase/utl/helper.h> | ||||||
| #include <ase/utl/ctype.h> | #include <ase/utl/ctype.h> | ||||||
| #include <stdlib.h> |  | ||||||
|  |  | ||||||
| static void* mmgr_malloc (void* custom, ase_size_t n) |  | ||||||
| { |  | ||||||
|         return malloc (n); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void* mmgr_realloc (void* custom, void* ptr, ase_size_t n) |  | ||||||
| { |  | ||||||
|         return realloc (ptr, n); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void mmgr_free (void* custom, void* ptr) |  | ||||||
| { |  | ||||||
|         free (ptr); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static ase_bool_t ccls_isupper (void* custom, ase_cint_t c)   | static ase_bool_t ccls_isupper (void* custom, ase_cint_t c)   | ||||||
| {  | {  | ||||||
| @ -87,14 +71,6 @@ static ase_cint_t ccls_tolower (void* custom, ase_cint_t c) | |||||||
| 	return ase_tolower (c); | 	return ase_tolower (c); | ||||||
| } | } | ||||||
|  |  | ||||||
| static ase_mmgr_t mmgr = |  | ||||||
| { |  | ||||||
| 	mmgr_malloc, |  | ||||||
| 	mmgr_realloc, |  | ||||||
| 	mmgr_free, |  | ||||||
| 	ASE_NULL |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static ase_ccls_t ccls = | static ase_ccls_t ccls = | ||||||
| { | { | ||||||
| 	ccls_isupper, | 	ccls_isupper, | ||||||
| @ -113,5 +89,4 @@ static ase_ccls_t ccls = | |||||||
| 	ASE_NULL | 	ASE_NULL | ||||||
| }; | }; | ||||||
|  |  | ||||||
| ase_mmgr_t* ase_mmgr = &mmgr; |  | ||||||
| ase_ccls_t* ase_ccls = &ccls; | ase_ccls_t* ase_ccls = &ccls; | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user