Exemplo n.º 1
0
Arquivo: block.c Projeto: Ced/cloog
/**
 * cloog_block_malloc function:
 * This function allocates the memory space for a CloogBlock structure and
 * sets its fields with default values. Then it returns a pointer to the
 * allocated space.
 * - November 21th 2005: first version.
 */
CloogBlock *cloog_block_malloc(CloogState *state)
{ CloogBlock * block ;
  
  /* Memory allocation for the CloogBlock structure. */
  block = (CloogBlock *)malloc(sizeof(CloogBlock)) ;
  if (block == NULL) 
    cloog_die("memory overflow.\n");
  cloog_block_leak_up(state);
  
  /* We set the various fields with default values. */
  block->state = state;
  block->statement = NULL ;
  block->nb_scaldims = 0 ;
  block->scaldims = NULL ;
  block->depth = 0 ;
  block->references = 1 ;
  block->usr = NULL;
  
  return block ;
}  
Exemplo n.º 2
0
/**
 * cloog_block_malloc function:
 * This function allocates the memory space for a CloogBlock structure and
 * sets its fields with default values. Then it returns a pointer to the
 * allocated space.
 * - November 21th 2005: first version.
 */
CloogBlock * cloog_block_malloc (void)
{ CloogBlock * block ;
  
  /* Memory allocation for the CloogBlock structure. */
  block = (CloogBlock *)malloc(sizeof(CloogBlock)) ;
  if (block == NULL) 
  { fprintf(stderr, "[CLooG]ERROR: memory overflow.\n") ;
    exit(1) ;
  }
  cloog_block_leak_up() ;
  
  /* We set the various fields with default values. */
  cloog_block_set_stmt (block, NULL);
  cloog_block_set_nb_scaldims (block, 0);
  cloog_block_set_scaldims (block, NULL);
  cloog_block_set_depth (block, 0);
  cloog_block_init_references (block);
  cloog_block_set_usr (block, NULL);
  
  return block ;
}