[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-devel] [task #14572] Protect gal_data_t's array and block poin
From: |
Antonio Diaz Diaz |
Subject: |
[gnuastro-devel] [task #14572] Protect gal_data_t's array and block pointers |
Date: |
Tue, 27 Jun 2017 16:59:08 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 |
Follow-up Comment #1, task #14572 (project gnuastro):
Maybe you could implement the feature the other way. Instead of a 'block'
pointer pointing to the larger array, you may implement an array of subtiles
in (the opaque) 'gal_data_t'. This also allows arbitrary levels of
tessellation, or mapping one particular region over several tiles, but makes
it easier to keep tile->array and tile->block in sync and avoid use-after-free
errors. The interface to the subtile array could be something like this:
// return subtile array size
int get_num_subtiles(gal_data_t *tile);
// get pointer to subtile
gal_data_t * get_subtile(gal_data_t *tile, int n);
// assemble and insert a new subtile in the array
bool insert_subtile(gal_data_t *tile, int n, ...);
// duplicate a subtile (perhaps from other tile) and insert it in the array
bool copy_subtile(gal_data_t *tile, int n, gal_data_t *subtile);
// delete subtile from array
bool delete_subtile(gal_data_t *tile, int n);
// this code maps the region defined by 'subtile2_3' of tile
// 'larger' over tile 'larger2'
gal_data_t * subtile2 = get_subtile(larger, 2);
gal_data_t * subtile2_3 = get_subtile(subtile2, 3);
copy_subtile(larger2, 0, subtile2_3);
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/task/?14572>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/