mirror of
				https://github.com/troglobit/editline.git
				synced 2025-10-31 08:18:11 +08:00 
			
		
		
		
	Refactor, simplify helper macro
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
		| @@ -1933,12 +1933,12 @@ static el_status_t el_bind_key_in_map(int key, el_keymap_func_t function, el_key | ||||
|  | ||||
| el_status_t el_bind_key(int key, el_keymap_func_t function) | ||||
| { | ||||
|     return el_bind_key_in_map(key, function, Map, ARRAY_ELEMENTS(Map)); | ||||
|     return el_bind_key_in_map(key, function, Map, NELEMS(Map)); | ||||
| } | ||||
|  | ||||
| el_status_t el_bind_key_in_metamap(int key, el_keymap_func_t function) | ||||
| { | ||||
|     return el_bind_key_in_map(key, function, MetaMap, ARRAY_ELEMENTS(MetaMap)); | ||||
|     return el_bind_key_in_map(key, function, MetaMap, NELEMS(MetaMap)); | ||||
| } | ||||
|  | ||||
| /** | ||||
|   | ||||
| @@ -57,8 +57,10 @@ | ||||
| #define MEM_INC         64 | ||||
| #define SCREEN_INC      256 | ||||
|  | ||||
| /* http://stackoverflow.com/questions/1598773/is-there-a-standard-function-in-c-that-would-return-the-length-of-an-array/1598827#1598827 */ | ||||
| #define ARRAY_ELEMENTS(arr) ((sizeof(arr)/sizeof(0[arr])) / ((size_t)(!(sizeof(arr) % sizeof(0[arr]))))) | ||||
| /* From The Practice of Programming, by Kernighan and Pike */ | ||||
| #ifndef NELEMS | ||||
| #define NELEMS(array) (sizeof(array) / sizeof(array[0])) | ||||
| #endif | ||||
|  | ||||
| /* | ||||
| **  Variables and routines internal to this package. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Joachim Nilsson
					Joachim Nilsson