diff options
author | pierrejoye <none@none> | 2013-04-03 14:23:11 +0200 |
---|---|---|
committer | pierrejoye <none@none> | 2013-04-03 14:23:11 +0200 |
commit | e20413bf6b872a8c23f1704a89295c5897347c9d (patch) | |
tree | f34b5402f97cd826bb312e18677f3974d53bfd52 /src/gdcache.c | |
parent | 385566e4ba57d803921a13306ead66f354cee0a2 (diff) | |
download | libgd-e20413bf6b872a8c23f1704a89295c5897347c9d.tar.gz |
- apply same CS everywhere
Diffstat (limited to 'src/gdcache.c')
-rw-r--r-- | src/gdcache.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/gdcache.c b/src/gdcache.c index a366561..b264d6e 100644 --- a/src/gdcache.c +++ b/src/gdcache.c @@ -15,11 +15,11 @@ #ifdef NEED_CACHE -/* +/* * gdcache.c * - * Caches of pointers to user structs in which the least-recently-used - * element is replaced in the event of a cache miss after the cache has + * Caches of pointers to user structs in which the least-recently-used + * element is replaced in the event of a cache miss after the cache has * reached a given size. * * John Ellson (ellson@graphviz.org) Oct 31, 1997 @@ -34,17 +34,17 @@ * The head structure has a pointer to the most-recently-used * element, and elements are moved to this position in the list each * time they are used. The head also contains pointers to three - * user defined functions: - * - a function to test if a cached userdata matches some keydata - * - a function to provide a new userdata struct to the cache + * user defined functions: + * - a function to test if a cached userdata matches some keydata + * - a function to provide a new userdata struct to the cache * if there has been a cache miss. * - a function to release a userdata struct when it is * no longer being managed by the cache * * In the event of a cache miss the cache is allowed to grow up to * a specified maximum size. After the maximum size is reached then - * the least-recently-used element is discarded to make room for the - * new. The most-recently-returned value is always left at the + * the least-recently-used element is discarded to make room for the + * new. The most-recently-returned value is always left at the * beginning of the list after retrieval. * * In the current implementation the cache is traversed by a linear @@ -61,9 +61,9 @@ /* create a new cache */ gdCache_head_t *gdCacheCreate(int size, - gdCacheTestFn_t gdCacheTest, - gdCacheFetchFn_t gdCacheFetch, - gdCacheReleaseFn_t gdCacheRelease) + gdCacheTestFn_t gdCacheTest, + gdCacheFetchFn_t gdCacheFetch, + gdCacheReleaseFn_t gdCacheRelease) { gdCache_head_t *head; @@ -134,7 +134,7 @@ void * gdCacheGet(gdCache_head_t *head, void *keydata) if(!elem) { (*(head->gdCacheRelease)) (userdata); return NULL; - } + } } else { /* cache full - replace least-recently-used */ /* preveprev becomes new end of list */ @@ -159,8 +159,7 @@ void * gdCacheGet(gdCache_head_t *head, void *keydata) #include <stdio.h> -typedef struct -{ +typedef struct { int key; int value; } |