diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-20 06:03:16 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-20 06:03:16 +0000 |
commit | 48d8ad5ac7dd9ea0f2a9a3646f3bc84f94941254 (patch) | |
tree | e527f2cb222809ccd66862b763928d39fe46824c /gcc/fortran/scanner.c | |
parent | a4970f2bc2de008ad17979079dad54a5a1bfa694 (diff) | |
download | gcc-48d8ad5ac7dd9ea0f2a9a3646f3bc84f94941254.tar.gz |
* arith.c (hollerith2representation): Fix for -Wc++-compat.
* array.c (gfc_get_constructor): Likewise.
* decl.c (gfc_get_data_variable, gfc_get_data_value, gfc_get_data,
create_enum_history, gfc_match_final_decl): Likewise.
* error.c (error_char): Likewise.
* expr.c (gfc_get_expr, gfc_copy_expr): Likewise.
* gfortran.h (gfc_get_charlen, gfc_get_array_spec,
gfc_get_component, gfc_get_formal_arglist, gfc_get_actual_arglist,
gfc_get_namelist, gfc_get_omp_clauses, gfc_get_interface,
gfc_get_common_head, gfc_get_dt_list, gfc_get_array_ref,
gfc_get_ref, gfc_get_equiv, gfc_get_case, gfc_get_iterator,
gfc_get_alloc, gfc_get_wide_string): Likewise.
* interface.c (count_types_test): Likewise.
* intrinsic.c (add_char_conversions, gfc_intrinsic_init_1):
Likewise.
* io.c (gfc_match_open, gfc_match_close, match_filepos, match_io,
gfc_match_inquire, gfc_match_wait): Likewise.
* match.c (gfc_match, match_forall_iterator): Likewise.
* module.c (gfc_get_pointer_info, gfc_get_use_rename, add_fixup,
add_true_name, parse_string, write_atom, quote_string,
mio_symtree_ref, mio_gmp_real, write_common_0): Likewise.
* options.c (gfc_post_options): Likewise.
* primary.c (match_integer_constant, match_hollerith_constant,
match_boz_constant, match_real_constant,
gfc_get_structure_ctor_component, gfc_match_structure_constructor): Likewise.
* scanner.c (gfc_widechar_to_char, add_path_to_list,
add_file_change, load_line, get_file, preprocessor_line,
load_file, unescape_filename, gfc_read_orig_filename): Likewise.
* simplify.c (gfc_simplify_ibits, gfc_simplify_ishft,
gfc_simplify_ishftc): Likewise.
* symbol.c (gfc_get_st_label, gfc_get_namespace, gfc_new_symtree,
gfc_get_uop, gfc_new_symbol, save_symbol_data, gfc_get_gsymbol):
Likewise.
* target-memory.c (gfc_target_interpret_expr): Likewise.
* trans-const.c (gfc_build_wide_string_const): Likewise.
* trans-expr.c (gfc_add_interface_mapping): Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_conversion,
gfc_conv_intrinsic_int, gfc_conv_intrinsic_lib_function,
gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_ctime,
gfc_conv_intrinsic_fdate, gfc_conv_intrinsic_ttynam,
gfc_conv_intrinsic_minmax, gfc_conv_intrinsic_minmax_char,
gfc_conv_intrinsic_ishftc, gfc_conv_intrinsic_index_scan_verify,
gfc_conv_intrinsic_merge, gfc_conv_intrinsic_trim): Likewise.
* trans.c (gfc_get_backend_locus): Likewise.
* trans.h (gfc_get_ss): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136982 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/scanner.c')
-rw-r--r-- | gcc/fortran/scanner.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 1b0eeca1e65..44e6d86bd4f 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -196,7 +196,7 @@ gfc_widechar_to_char (const gfc_char_t *s, int length) /* Passing a negative length is used to indicate that length should be calculated using gfc_wide_strlen(). */ len = (length >= 0 ? (size_t) length : gfc_wide_strlen (s)); - res = gfc_getmem (len + 1); + res = XNEWVEC (char, len + 1); for (i = 0; i < len; i++) { @@ -319,19 +319,19 @@ add_path_to_list (gfc_directorylist **list, const char *path, dir = *list; if (!dir) - dir = *list = gfc_getmem (sizeof (gfc_directorylist)); + dir = *list = XCNEW (gfc_directorylist); else { while (dir->next) dir = dir->next; - dir->next = gfc_getmem (sizeof (gfc_directorylist)); + dir->next = XCNEW (gfc_directorylist); dir = dir->next; } dir->next = NULL; dir->use_for_modules = use_for_modules; - dir->path = gfc_getmem (strlen (p) + 2); + dir->path = XCNEWVEC (char, strlen (p) + 2); strcpy (dir->path, p); strcat (dir->path, "/"); /* make '/' last character */ } @@ -495,9 +495,8 @@ add_file_change (const char *filename, int line) file_changes_allocated *= 2; else file_changes_allocated = 16; - file_changes - = xrealloc (file_changes, - file_changes_allocated * sizeof (*file_changes)); + file_changes = XRESIZEVEC (struct gfc_file_change, file_changes, + file_changes_allocated); } file_changes[file_changes_count].filename = filename; file_changes[file_changes_count].lb = NULL; @@ -1451,7 +1450,7 @@ load_line (FILE *input, gfc_char_t **pbuf, int *pbuflen, const int *first_char) /* Reallocate line buffer to double size to hold the overlong line. */ buflen = buflen * 2; - *pbuf = xrealloc (*pbuf, (buflen + 1) * sizeof (gfc_char_t)); + *pbuf = XRESIZEVEC (gfc_char_t, *pbuf, (buflen + 1)); buffer = (*pbuf) + i; } } @@ -1501,10 +1500,9 @@ get_file (const char *name, enum lc_reason reason ATTRIBUTE_UNUSED) { gfc_file *f; - f = gfc_getmem (sizeof (gfc_file)); + f = XCNEW (gfc_file); - f->filename = gfc_getmem (strlen (name) + 1); - strcpy (f->filename, name); + f->filename = xstrdup (name); f->next = file_head; file_head = f; @@ -1655,8 +1653,7 @@ preprocessor_line (gfc_char_t *c) if (strcmp (current_file->filename, filename) != 0) { gfc_free (current_file->filename); - current_file->filename = gfc_getmem (strlen (filename) + 1); - strcpy (current_file->filename, filename); + current_file->filename = xstrdup (filename); } /* Set new line number. */ @@ -1881,8 +1878,8 @@ load_file (const char *filename, bool initial) /* Add line. */ - b = gfc_getmem (gfc_linebuf_header_size - + (len + 1) * sizeof (gfc_char_t)); + b = (gfc_linebuf *) gfc_getmem (gfc_linebuf_header_size + + (len + 1) * sizeof (gfc_char_t)); b->location = linemap_line_start (line_table, current_file->line++, 120); @@ -1973,7 +1970,7 @@ unescape_filename (const char *ptr) /* Undo effects of cpp_quote_string. */ s = ptr; - d = gfc_getmem (p + 1 - ptr - unescape); + d = XCNEWVEC (char, p + 1 - ptr - unescape); ret = d; while (s != p) @@ -2046,7 +2043,7 @@ gfc_read_orig_filename (const char *filename, const char **canon_source_file) if (! IS_ABSOLUTE_PATH (filename)) { - char *p = gfc_getmem (len + strlen (filename)); + char *p = XCNEWVEC (char, len + strlen (filename)); memcpy (p, dirname, len - 2); p[len - 2] = '/'; |