diff -r bd5998ee8876 -r ff4d26b7e51d stage3/datatype_functions.cc --- a/stage3/datatype_functions.cc Mon Feb 13 17:04:29 2012 +0000 +++ b/stage3/datatype_functions.cc Thu Feb 16 10:27:52 2012 +0000 @@ -172,6 +172,9 @@ * Returns: position of datatype in the list, or -1 if not found. */ int search_in_datatype_list(symbol_c *datatype, std::vector candidate_datatypes) { + if (NULL == datatype) + return -1; + for(unsigned int i = 0; i < candidate_datatypes.size(); i++) if (is_type_equal(datatype, candidate_datatypes[i])) return i; @@ -180,6 +183,24 @@ } + + + +/* Copy the elements in the candidate_datatype_list in one symbol (from) + * into the candidate_datatype_list of another symbol (to) + */ +void copy_candidate_datatype_list(symbol_c *from, symbol_c *to) { + if ((NULL == from) || (NULL == to)) + return; + + for(unsigned int i = 0; i < from->candidate_datatypes.size(); i++) + to->candidate_datatypes.push_back(from->candidate_datatypes[i]); +} + + + + + /* A helper function... */ bool is_ANY_ELEMENTARY_type(symbol_c *type_symbol) { if (type_symbol == NULL) {return false;}