summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <david@freetype.org>2005-10-13 15:17:46 +0000
committerDavid Turner <david@freetype.org>2005-10-13 15:17:46 +0000
commit9876e59533420b2027939be6943b2c6bc3af3a9f (patch)
treef3016899feaba79246dc94b82356614fb8ad0aba
parent5944eff19dc8c782bdcda170f234f7bfbf0f88f1 (diff)
downloadfreetype2-CACHE.tar.gz
* src/cache/ftcmanag.c (FTC_Manager_Reset): add missing cache flushCACHE-STEP-2CACHE
* src/cache/ftcback.h, src/cache/rules.mk: removed obsolete ftcback.h which was revived by the merge operation (blooody cvs) * src/cache/ftcsbit.c: using FTC_RETRY_LOOP ... FTC_RETRY_END
-rw-r--r--ChangeLog7
-rw-r--r--src/cache/ftccback.h85
-rw-r--r--src/cache/ftcmanag.c2
-rw-r--r--src/cache/ftcsbits.c36
-rw-r--r--src/cache/rules.mk3
5 files changed, 11 insertions, 122 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f9c30e9e..94800cc0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,13 @@
* MANY FILES... Mergin with main branch (HEAD)
+ * src/cache/ftcmanag.c (FTC_Manager_Reset): add missing cache flush
+
+ * src/cache/ftcback.h, src/cache/rules.mk: removed obsolete ftcback.h
+ which was revived by the merge operation (blooody cvs)
+
+ * src/cache/ftcsbit.c: using FTC_RETRY_LOOP ... FTC_RETRY_END
+
2005-09-21 David Turner <david@freetype.org>
* massive redesign of the cache sub-system internals.
diff --git a/src/cache/ftccback.h b/src/cache/ftccback.h
deleted file mode 100644
index 6b47e095e..000000000
--- a/src/cache/ftccback.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/***************************************************************************/
-/* */
-/* ftccback.h */
-/* */
-/* Callback functions of the caching sub-system (specification only). */
-/* */
-/* Copyright 2004 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-#ifndef __FTCCBACK_H__
-#define __FTCCBACK_H__
-
-#include <ft2build.h>
-#include FT_CACHE_H
-#include FT_CACHE_INTERNAL_MRU_H
-#include FT_CACHE_INTERNAL_IMAGE_H
-#include FT_CACHE_INTERNAL_MANAGER_H
-#include FT_CACHE_INTERNAL_GLYPH_H
-#include FT_CACHE_INTERNAL_SBITS_H
-
-
- FT_LOCAL( void )
- ftc_inode_free( FTC_Node inode,
- FTC_Cache cache );
-
- FT_LOCAL( FT_Error )
- ftc_inode_new( FTC_Node *pinode,
- FT_Pointer gquery,
- FTC_Cache cache );
-
- FT_LOCAL( FT_ULong )
- ftc_inode_weight( FTC_Node inode,
- FTC_Cache cache );
-
-
- FT_LOCAL( void )
- ftc_snode_free( FTC_Node snode,
- FTC_Cache cache );
-
- FT_LOCAL( FT_Error )
- ftc_snode_new( FTC_Node *psnode,
- FT_Pointer gquery,
- FTC_Cache cache );
-
- FT_LOCAL( FT_ULong )
- ftc_snode_weight( FTC_Node snode,
- FTC_Cache cache );
-
- FT_LOCAL( FT_Bool )
- ftc_snode_compare( FTC_Node snode,
- FT_Pointer gquery,
- FTC_Cache cache );
-
-
- FT_LOCAL( FT_Bool )
- ftc_gnode_compare( FTC_Node gnode,
- FT_Pointer gquery,
- FTC_Cache cache );
-
-
- FT_LOCAL( FT_Error )
- ftc_gcache_init( FTC_Cache cache );
-
- FT_LOCAL( void )
- ftc_gcache_done( FTC_Cache cache );
-
-
- FT_LOCAL( FT_Error )
- ftc_cache_init( FTC_Cache cache );
-
- FT_LOCAL( void )
- ftc_cache_done( FTC_Cache cache );
-
-
-#endif /* __FTCCBACK_H__ */
-
-/* END */
diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c
index 186e69aa2..874d69dce 100644
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -444,7 +444,7 @@
FTC_MruList_Reset( &manager->sizes );
FTC_MruList_Reset( &manager->faces );
}
- /* XXX: FIXME: flush the caches? */
+ FTC_Manager_FlushN( manager, manager->num_nodes );
}
diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c
index 54f044404..8f8a25a28 100644
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -288,38 +288,6 @@
FTC_SBit sbit = snode->sbits + ( gindex - gnode->gindex );
- /*
- * The following code illustrates what to do when you want to
- * perform operations that may fail within a lookup function.
- *
- * Here, we want to load a small bitmap on-demand; we thus
- * need to call the `ftc_snode_load' function which may return
- * a non-zero error code only when we are out of memory (OOM).
- *
- * The correct thing to do is to use @FTC_CACHE_TRYLOOP and
- * @FTC_CACHE_TRYLOOP_END in order to implement a retry loop
- * that is capable of flushing the cache incrementally when
- * an OOM errors occur.
- *
- * However, we need to `lock' the node before this operation to
- * prevent it from being flushed within the loop.
- *
- * When we exit the loop, we unlock the node, then check the `error'
- * variable. If it is non-zero, this means that the cache was
- * completely flushed and that no usable memory was found to load
- * the bitmap.
- *
- * We then prefer to return a value of 0 (i.e., NO MATCH). This
- * ensures that the caller will try to allocate a new node.
- * This operation consequently _fail_ and the lookup function
- * returns the appropriate OOM error code.
- *
- * Note that `buffer == NULL && width == 255' is a hack used to
- * tag `unavailable' bitmaps in the array. We should never try
- * to load these.
- *
- */
-
if ( sbit->buffer == NULL && sbit->width != 255 )
{
FT_ULong size;
@@ -329,11 +297,11 @@
FTC_NODE_REF(snode); /* lock node to prevent flushing */
/* in retry loop */
- FTC_CACHE_TRYLOOP( cache )
+ FTC_RETR_LOOP( cache->manager )
{
error = ftc_snode_load( snode, cache->manager, gindex, &size );
}
- FTC_CACHE_TRYLOOP_END();
+ FTC_RETRY_END( error );
FTC_NODE(snode)->ref_count--; /* unlock the node */
diff --git a/src/cache/rules.mk b/src/cache/rules.mk
index 9d22611e7..a51151ab2 100644
--- a/src/cache/rules.mk
+++ b/src/cache/rules.mk
@@ -42,8 +42,7 @@ CACHE_DRV_H := $(CACHE_H_DIR)/ftcmru.h \
$(CACHE_H_DIR)/ftcimage.h \
$(CACHE_H_DIR)/ftccmap.h \
$(CACHE_DIR)/ftcerror.h \
- $(CACHE_DIR)/ftcint.h \
- $(CACHE_DIR)/ftccback.h
+ $(CACHE_DIR)/ftcint.h
# Cache driver object(s)