Changeset 687
- Timestamp:
- 03/23/07 13:24:42 (2 years ago)
- Files:
-
- tests/cache/Makefile (modified) (1 diff)
- tests/cache/cache.c (modified) (2 diffs)
- tests/cache/cache.h (modified) (2 diffs)
- tests/cache/cache_obj_http.h (modified) (2 diffs)
- tests/cache/cache_table.c (modified) (1 diff)
- tests/cache/cache_table.h (modified) (2 diffs)
- tests/cache/test.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tests/cache/Makefile
r669 r687 1 CHEROKEE_PATH=../../../cherokee 2 CHEROKEE_DEPS=-lssl 3 1 4 CC = gcc 2 CFLAGS = -O0 -g3 -Wall -I.. -DCHEROKEE_COMPILATION 3 LIBS = -lcherokee-base -lssl 4 SRCS = caching.c cherokee.h 5 CFLAGS = -O0 -g3 -Wall -I. -I.. -I$(CHEROKEE_PATH) -I$(CHEROKEE_PATH)/cherokee -DCHEROKEE_COMPILATION 6 LIBS = -lcherokee-base $(CHEROKEE_DEPS) 5 7 6 OBJS = cache.o cache_ table.o cache_obj.o cache_obj_http.o caching.o7 PROG = caching8 OBJS = cache.o cache_obj.o cache_table.o cache_obj_http.o test.o 9 PROG = test 8 10 9 .c.o: $(SRCS)11 .c.o: 10 12 $(CC) $(CFLAGS) -c -o $@ $< 13 11 14 $(PROG): $(OBJS) 12 15 $(CC) -o $@ $(OBJS) $(LIBS) 16 17 clean: 18 rm -f $(OBJS) $(PROG) tests/cache/cache.c
r669 r687 126 126 127 127 ret_t 128 cherokee_cache_clean_up (cherokee_cache_t *cache , void *free_func)128 cherokee_cache_clean_up (cherokee_cache_t *cache) 129 129 { 130 130 ret_t ret; … … 132 132 /* Sanity check 133 133 */ 134 return_if_fail (cache != NULL, ret_error);135 134 if (CACHE(cache)->clean_up == NULL) 136 135 return ret_error; 137 136 138 ret = CACHE(cache)->clean_up (cache, free_func); 139 if (unlikely (ret != ret_ok)) return ret; 137 ret = CACHE(cache)->clean_up (cache); 138 if (unlikely (ret != ret_ok)) 139 return ret; 140 140 141 141 return ret_ok; tests/cache/cache.h
r669 r687 43 43 typedef ret_t (* cherokee_cache_func_del_t) (struct cherokee_cache *cache, cherokee_buffer_t *key, struct cherokee_cache_obj **item); 44 44 typedef ret_t (* cherokee_cache_func_get_t) (struct cherokee_cache *cache, cherokee_buffer_t *key, struct cherokee_cache_obj **item); 45 typedef ret_t (* cherokee_cache_func_clean_up_t) (struct cherokee_cache *cache , void *free_func);45 typedef ret_t (* cherokee_cache_func_clean_up_t) (struct cherokee_cache *cache); 46 46 47 47 struct cherokee_cache { … … 64 64 ret_t cherokee_cache_add (cherokee_cache_t *cache, cherokee_buffer_t *key, cherokee_cache_obj_t *item); 65 65 ret_t cherokee_cache_get (cherokee_cache_t *cache, cherokee_buffer_t *key, cherokee_cache_obj_t **item); 66 ret_t cherokee_cache_clean_up (cherokee_cache_t *cache , void *free_func);66 ret_t cherokee_cache_clean_up (cherokee_cache_t *cache); 67 67 68 68 tests/cache/cache_obj_http.h
r669 r687 23 23 */ 24 24 25 #if !defined (CHEROKEE_INSIDE_CHEROKEE_H) && !defined (CHEROKEE_COMPILATION) 26 # error "Only <cherokee/cherokee.h> can be included directly, this file may disappear or change contents." 27 #endif 28 29 #ifndef CHEROKEE_CACHE_OBJ_HTTP_H 30 #define CHEROKEE_CACHE_OBJ_HTTP_H 31 25 32 #include <cherokee/common.h> 33 #include <cherokee/buffer.h> 26 34 #include <cherokee/cache_obj.h> 27 #include <cherokee/buffer.h> 35 36 CHEROKEE_BEGIN_DECLS 37 28 38 29 39 /* Data types 30 40 */ 31 32 41 typedef struct { 33 42 cherokee_cache_obj_t parent; … … 43 52 44 53 54 CHEROKEE_END_DECLS 55 56 #endif /* CHEROKEE_CACHE_OBJ_HTTP_H */ tests/cache/cache_table.c
r669 r687 48 48 49 49 static ret_t 50 clean_up (cherokee_cache_t *cache , void *free_func)50 clean_up (cherokee_cache_t *cache) 51 51 { 52 52 return ret_ok; tests/cache/cache_table.h
r669 r687 31 31 32 32 #include <cherokee/cache.h> 33 #include "table.h"34 #include "list.h"33 #include <cherokee/table.h> 34 #include <cherokee/list.h> 35 35 36 36 CHEROKEE_BEGIN_DECLS … … 39 39 cherokee_cache_t parent; 40 40 41 /* Obj 's collection41 /* Objects collection 42 42 */ 43 cherokee_table_t objs; /* cherokee_cache_obj_t 's */43 cherokee_table_t objs; /* cherokee_cache_obj_ts */ 44 44 } cherokee_cache_table_t; 45 45 tests/cache/test.c
r669 r687 47 47 cherokee_buffer_add_va (&obj->id, "info-%d", i); 48 48 49 cherokee_cache_gen_key (CACHE(&cache1), &key, &obj->id);49 // cherokee_cache_gen_key (CACHE(&cache1), &key, &obj->id); 50 50 51 51 cherokee_buffer_add_va (&obj->body, "<html>%d</html>", i); 52 52 cherokee_cache_add (CACHE(&cache1), key, CACHE_OBJ(obj)); 53 53 54 cherokee_buffer_free(key); 54 // cherokee_buffer_free (key); 55 55 } 56 56 57 cherokee_cache_clean_up (CACHE(&cache1) , cherokee_cache_obj_http_free);57 cherokee_cache_clean_up (CACHE(&cache1)); 58 58 cherokee_cache_table_mrproper (&cache1); 59 59