diff options
author | Adrian Thurston <thurston@complang.org> | 2015-01-04 18:11:00 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2015-01-04 18:11:00 -0500 |
commit | 4accc36ee55e6ce863ec2e1940ca84b776442e1f (patch) | |
tree | 8abc854db7a25b7d14fee377a1b63e44a82fe6eb /src/struct.c | |
parent | fab48262c6e559f1f6aabff0868cb41bfdb296bf (diff) | |
download | colm-4accc36ee55e6ce863ec2e1940ca84b776442e1f.tar.gz |
work on using embedded list element pointers
Diffstat (limited to 'src/struct.c')
-rw-r--r-- | src/struct.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/struct.c b/src/struct.c index 6a71194d..ba224f2d 100644 --- a/src/struct.c +++ b/src/struct.c @@ -26,7 +26,7 @@ static void colm_struct_add( Program *prg, struct colm_struct *item ) } } -static struct colm_struct *colm_struct_new_size( Program *prg, int size ) +struct colm_struct *colm_struct_new_size( Program *prg, int size ) { size_t memsize = sizeof(struct colm_struct) + ( sizeof(Tree*) * size ); struct colm_struct *item = (struct colm_struct*) malloc( memsize ); @@ -111,7 +111,7 @@ void colm_list_destroy( Program *prg, Tree **sp, struct colm_struct *s ) ListEl *el = list->head; while ( el != 0 ) { ListEl *next = el->list_next; - treeDownref( prg, sp, el->value ); +// treeDownref( prg, sp, el->value ); //listElFree( prg, el ); el = next; } @@ -174,14 +174,14 @@ Tree *colm_list_el_get( ListEl *listEl, Word field ) Tree *result = 0; switch ( field ) { case 0: - result = listEl->list_prev; + result = (Tree*)listEl->list_prev; break; case 1: - result = listEl->list_next; + result = (Tree*)listEl->list_next; break; case 2: - result = listEl->value; - treeUpref( result ); +// result = listEl->value; +// treeUpref( result ); break; // default: // assert( false ); @@ -190,13 +190,3 @@ Tree *colm_list_el_get( ListEl *listEl, Word field ) return result; } -struct colm_list_el *colm_list_el_new( struct colm_program *prg ) -{ - size_t memsize = sizeof(struct colm_list_el); - struct colm_list_el *el = (struct colm_list_el*) malloc( memsize ); - memset( el, 0, memsize ); - colm_struct_add( prg, (struct colm_struct *)el ); - el->id = -22; //STRUCT_INBUILT_ID; - return el; -} - |