diff --git a/ChangeLog b/ChangeLog index 772bfc9f58..c389c485b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Thu Jan 6 18:39:05 GMT 2000 Adam D. Moss + + * app/tile_cache.c + * app/tile_swap.c: Maybe fixed tile_cache_set_size() + so that it actually works now. You can use this to set GIMP's + tile cache size at runtime without restarting. If the prefs + guys (Sven, Michael?) don't wire it in I'll look at it, but it + can't be soon. + 2000-01-06 Michael Natterer * app/[all files using the dialog or action area constructors] diff --git a/app/base/tile-cache.c b/app/base/tile-cache.c index 2fa169e838..db72b2a8af 100644 --- a/app/base/tile-cache.c +++ b/app/base/tile-cache.c @@ -112,9 +112,12 @@ tile_cache_insert (Tile *tile) { g_warning ("cache: unable to find room for a tile"); goto out; + /* goto grump;*/ } } + /*grump:*/ + /* Note the increase in the number of bytes the cache * is referencing. */ @@ -196,6 +199,8 @@ tile_cache_flush_internal (Tile *tile) } } + +/* untested -- ADM */ void tile_cache_set_size (unsigned long cache_size) { @@ -204,9 +209,10 @@ tile_cache_set_size (unsigned long cache_size) max_cache_size = cache_size; CACHE_LOCK; - while (cache_size >= max_cache_size) + while (cur_cache_size > max_cache_size) { - if (!tile_cache_zorch_next ()) break; + if (!tile_cache_zorch_next ()) + break; } CACHE_UNLOCK; } @@ -239,7 +245,7 @@ tile_cache_zorch_next () { Tile *tile; - /* printf("cache zorch: %u/%u\n", cur_cache_size, cur_cache_dirty); */ + /* fprintf(stderr, "cache zorch: %u/%u\n", cur_cache_size, cur_cache_dirty);*/ if (clean_list.first) tile = clean_list.first; else if (dirty_list.first) tile = dirty_list.first; diff --git a/app/base/tile-swap.c b/app/base/tile-swap.c index 535558a51f..9e0b2a4853 100644 --- a/app/base/tile-swap.c +++ b/app/base/tile-swap.c @@ -717,7 +717,11 @@ tile_swap_resize (DefSwapFile *def_swap_file, long new_size) { if (def_swap_file->swap_file_end > new_size) - ftruncate (fd, new_size); + { + ftruncate (fd, new_size); + /*fprintf(stderr, "TRUNCATED SWAP from %d to %d bytes.\n", + (int)def_swap_file->swap_file_end, (int) new_size);*/ + } def_swap_file->swap_file_end = new_size; } diff --git a/app/tile_cache.c b/app/tile_cache.c index 2fa169e838..db72b2a8af 100644 --- a/app/tile_cache.c +++ b/app/tile_cache.c @@ -112,9 +112,12 @@ tile_cache_insert (Tile *tile) { g_warning ("cache: unable to find room for a tile"); goto out; + /* goto grump;*/ } } + /*grump:*/ + /* Note the increase in the number of bytes the cache * is referencing. */ @@ -196,6 +199,8 @@ tile_cache_flush_internal (Tile *tile) } } + +/* untested -- ADM */ void tile_cache_set_size (unsigned long cache_size) { @@ -204,9 +209,10 @@ tile_cache_set_size (unsigned long cache_size) max_cache_size = cache_size; CACHE_LOCK; - while (cache_size >= max_cache_size) + while (cur_cache_size > max_cache_size) { - if (!tile_cache_zorch_next ()) break; + if (!tile_cache_zorch_next ()) + break; } CACHE_UNLOCK; } @@ -239,7 +245,7 @@ tile_cache_zorch_next () { Tile *tile; - /* printf("cache zorch: %u/%u\n", cur_cache_size, cur_cache_dirty); */ + /* fprintf(stderr, "cache zorch: %u/%u\n", cur_cache_size, cur_cache_dirty);*/ if (clean_list.first) tile = clean_list.first; else if (dirty_list.first) tile = dirty_list.first; diff --git a/app/tile_swap.c b/app/tile_swap.c index 535558a51f..9e0b2a4853 100644 --- a/app/tile_swap.c +++ b/app/tile_swap.c @@ -717,7 +717,11 @@ tile_swap_resize (DefSwapFile *def_swap_file, long new_size) { if (def_swap_file->swap_file_end > new_size) - ftruncate (fd, new_size); + { + ftruncate (fd, new_size); + /*fprintf(stderr, "TRUNCATED SWAP from %d to %d bytes.\n", + (int)def_swap_file->swap_file_end, (int) new_size);*/ + } def_swap_file->swap_file_end = new_size; }