[Patch, fortran] Use xcalloc instead of gfc_getmem

Janne Blomqvist blomqvist.janne@gmail.com
Mon Apr 18 20:50:00 GMT 2011


Hi,

the attached patch replaces gfc_getmem with calls to xcalloc (from
libiberty). Apart from reducing duplicated code, calloc is better than
malloc + memset, as the allocator knows that the kernel always gives
out zeroed pages so in some cases it can avoid memset'in the area.

Regtested on x86_64-unknown-linux-gnu, Ok for trunk?

2011-04-18  Janne Blomqvist  <jb@gcc.gnu.org>

	* misc.c (gfc_getmem): Remove function.
	* gfortran.h: Remove gfc_getmem prototype. Replace gfc_getmem
	usage with xcalloc.
	* expr.c (gfc_check_assign_symbol): Replace gfc_getmem usage with
	xcalloc.
	* options.c (gfc_handle_module_path_options)
	(gfc_get_option_string): Likewise.
	* resolve.c (gfc_resolve_forall): Likewise.
	* scanner.c (load_file): Likewise.
	* simplify.c (simplify_transformation_to_array): Likewise.
	* target-memory.c (gfc_target_interpret_expr): Likewise.
	* trans-common.c (get_segment_info, copy_equiv_list_to_ns)
	(get_init_field): Likewise.
	* trans-expr.c (gfc_conv_statement_function): Likewise.
	* trans-io.c (nml_full_name): Likewise.
	* trans-stmt.c (gfc_trans_forall_1): Likewise.

-- 
Janne Blomqvist
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xcalloc.diff
Type: text/x-patch
Size: 10592 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110418/2af82d56/attachment.bin>


More information about the Gcc-patches mailing list