Commit a92cb0c3 by Jens-Michael Hoffmann Committed by Andrew Haley

buffer.c: Remove unnecessary casts.

2002-11-14  Jens-Michael Hoffmann  <jensmh@gmx.de>

        * buffer.c: Remove unnecessary casts.
        * check-init.c: Likewise.
        * class.c: Likewise.
        * constants.c: Likewise.
        * decl.c: Likewise.
        * except.c: Likewise.
        * gjavah.c: Likewise.
        * jcf-io.c: Likewise.
        * jcf-parse.c: Likewise.
        * jcf-path.c: Likewise.
        * jvspec.c: Likewise.
        * lang.c: Likewise.
        * lex.c: Likewise.
        * verify.c: Likewise.

From-SVN: r59224
parent e7e0de7e
2002-11-14 Jens-Michael Hoffmann <jensmh@gmx.de>
* buffer.c: Remove unnecessary casts.
* check-init.c: Likewise.
* class.c: Likewise.
* constants.c: Likewise.
* decl.c: Likewise.
* except.c: Likewise.
* gjavah.c: Likewise.
* jcf-io.c: Likewise.
* jcf-parse.c: Likewise.
* jcf-path.c: Likewise.
* jvspec.c: Likewise.
* lang.c: Likewise.
* lex.c: Likewise.
* verify.c: Likewise.
2002-11-06 Tom Tromey <tromey@redhat.com> 2002-11-06 Tom Tromey <tromey@redhat.com>
* gjavah.c (print_stub_or_jni): Include JNIEXPORT and JNICALL in * gjavah.c (print_stub_or_jni): Include JNIEXPORT and JNICALL in
......
...@@ -37,14 +37,14 @@ buffer_grow (bufp, size) ...@@ -37,14 +37,14 @@ buffer_grow (bufp, size)
{ {
if (size < 120) if (size < 120)
size = 120; size = 120;
bufp->data = (unsigned char*) xmalloc (size); bufp->data = xmalloc (size);
bufp->ptr = bufp->data; bufp->ptr = bufp->data;
} }
else else
{ {
int index = bufp->ptr - bufp->data; int index = bufp->ptr - bufp->data;
size += 2 * (bufp->limit - bufp->data); size += 2 * (bufp->limit - bufp->data);
bufp->data = (unsigned char *) xrealloc (bufp->data, size); bufp->data = xrealloc (bufp->data, size);
bufp->ptr = bufp->data + index; bufp->ptr = bufp->data + index;
} }
bufp->limit = bufp->data + size; bufp->limit = bufp->data + size;
......
...@@ -108,7 +108,7 @@ static tree get_variable_decl PARAMS ((tree)); ...@@ -108,7 +108,7 @@ static tree get_variable_decl PARAMS ((tree));
static void final_assign_error PARAMS ((tree)); static void final_assign_error PARAMS ((tree));
static void check_final_reassigned PARAMS ((tree, words)); static void check_final_reassigned PARAMS ((tree, words));
#define ALLOC_WORDS(NUM) ((word*) xmalloc ((NUM) * sizeof (word))) #define ALLOC_WORDS(NUM) (xmalloc ((NUM) * sizeof (word)))
#define FREE_WORDS(PTR) (free (PTR)) #define FREE_WORDS(PTR) (free (PTR))
/* DECLARE_BUFFERS is used to allocate NUMBUFFER bit sets, each of /* DECLARE_BUFFERS is used to allocate NUMBUFFER bit sets, each of
......
...@@ -150,7 +150,7 @@ add_assume_compiled (ident, excludep) ...@@ -150,7 +150,7 @@ add_assume_compiled (ident, excludep)
{ {
assume_compiled_node *parent; assume_compiled_node *parent;
assume_compiled_node *node = assume_compiled_node *node =
(assume_compiled_node *) xmalloc (sizeof (assume_compiled_node)); xmalloc (sizeof (assume_compiled_node));
node->ident = xstrdup (ident); node->ident = xstrdup (ident);
node->excludep = excludep; node->excludep = excludep;
...@@ -160,8 +160,7 @@ add_assume_compiled (ident, excludep) ...@@ -160,8 +160,7 @@ add_assume_compiled (ident, excludep)
if (NULL == assume_compiled_tree) if (NULL == assume_compiled_tree)
{ {
assume_compiled_tree = assume_compiled_tree = xmalloc (sizeof (assume_compiled_node));
(assume_compiled_node *) xmalloc (sizeof (assume_compiled_node));
assume_compiled_tree->ident = ""; assume_compiled_tree->ident = "";
assume_compiled_tree->excludep = 0; assume_compiled_tree->excludep = 0;
assume_compiled_tree->sibling = NULL; assume_compiled_tree->sibling = NULL;
...@@ -232,7 +231,7 @@ ident_subst (old_name, old_length, prefix, old_char, new_char, suffix) ...@@ -232,7 +231,7 @@ ident_subst (old_name, old_length, prefix, old_char, new_char, suffix)
#ifdef __GNUC__ #ifdef __GNUC__
char buffer[i]; char buffer[i];
#else #else
char *buffer = (char *)alloca (i); char *buffer = alloca (i);
#endif #endif
strcpy (buffer, prefix); strcpy (buffer, prefix);
for (i = 0; i < old_length; i++) for (i = 0; i < old_length; i++)
...@@ -613,7 +612,7 @@ add_method_1 (this_class, access_flags, name, function_type) ...@@ -613,7 +612,7 @@ add_method_1 (this_class, access_flags, name, function_type)
DECL_CONTEXT (fndecl) = this_class; DECL_CONTEXT (fndecl) = this_class;
DECL_LANG_SPECIFIC (fndecl) DECL_LANG_SPECIFIC (fndecl)
= (struct lang_decl *) ggc_alloc_cleared (sizeof (struct lang_decl)); = ggc_alloc_cleared (sizeof (struct lang_decl));
DECL_LANG_SPECIFIC (fndecl)->desc = LANG_DECL_FUNC; DECL_LANG_SPECIFIC (fndecl)->desc = LANG_DECL_FUNC;
/* Initialize the static initializer test table. */ /* Initialize the static initializer test table. */
......
...@@ -47,8 +47,8 @@ set_constant_entry (cpool, index, tag, value) ...@@ -47,8 +47,8 @@ set_constant_entry (cpool, index, tag, value)
if (cpool->data == NULL) if (cpool->data == NULL)
{ {
cpool->capacity = 100; cpool->capacity = 100;
cpool->tags = (uint8*) xmalloc (sizeof(uint8) * cpool->capacity); cpool->tags = xmalloc (sizeof(uint8) * cpool->capacity);
cpool->data = (jword*) xmalloc (sizeof(jword) * cpool->capacity); cpool->data = xmalloc (sizeof(jword) * cpool->capacity);
cpool->count = 1; cpool->count = 1;
} }
if (index >= cpool->capacity) if (index >= cpool->capacity)
...@@ -56,10 +56,8 @@ set_constant_entry (cpool, index, tag, value) ...@@ -56,10 +56,8 @@ set_constant_entry (cpool, index, tag, value)
cpool->capacity *= 2; cpool->capacity *= 2;
if (index >= cpool->capacity) if (index >= cpool->capacity)
cpool->capacity = index + 10; cpool->capacity = index + 10;
cpool->tags = (uint8*) xrealloc (cpool->tags, cpool->tags = xrealloc (cpool->tags, sizeof(uint8) * cpool->capacity);
sizeof(uint8) * cpool->capacity); cpool->data = xrealloc (cpool->data, sizeof(jword) * cpool->capacity);
cpool->data = (jword*) xrealloc (cpool->data,
sizeof(jword) * cpool->capacity);
} }
if (index >= cpool->count) if (index >= cpool->count)
cpool->count = index + 1; cpool->count = index + 1;
......
...@@ -1183,7 +1183,7 @@ static struct binding_level * ...@@ -1183,7 +1183,7 @@ static struct binding_level *
make_binding_level () make_binding_level ()
{ {
/* NOSTRICT */ /* NOSTRICT */
return (struct binding_level *) xmalloc (sizeof (struct binding_level)); return xmalloc (sizeof (struct binding_level));
} }
void void
...@@ -1778,7 +1778,7 @@ start_java_method (fndecl) ...@@ -1778,7 +1778,7 @@ start_java_method (fndecl)
i = DECL_MAX_LOCALS(fndecl) + DECL_MAX_STACK(fndecl); i = DECL_MAX_LOCALS(fndecl) + DECL_MAX_STACK(fndecl);
decl_map = make_tree_vec (i); decl_map = make_tree_vec (i);
type_map = (tree *) xrealloc (type_map, i * sizeof (tree)); type_map = xrealloc (type_map, i * sizeof (tree));
#if defined(DEBUG_JAVA_BINDING_LEVELS) #if defined(DEBUG_JAVA_BINDING_LEVELS)
fprintf (stderr, "%s:\n", lang_printable_name (fndecl, 2)); fprintf (stderr, "%s:\n", lang_printable_name (fndecl, 2));
......
...@@ -153,8 +153,7 @@ link_handler (range, outer) ...@@ -153,8 +153,7 @@ link_handler (range, outer)
/* Handle overlapping ranges by splitting the new range. */ /* Handle overlapping ranges by splitting the new range. */
if (range->start_pc < outer->start_pc || range->end_pc > outer->end_pc) if (range->start_pc < outer->start_pc || range->end_pc > outer->end_pc)
{ {
struct eh_range *h struct eh_range *h = xmalloc (sizeof (struct eh_range));
= (struct eh_range *) xmalloc (sizeof (struct eh_range));
if (range->start_pc < outer->start_pc) if (range->start_pc < outer->start_pc)
{ {
h->start_pc = range->start_pc; h->start_pc = range->start_pc;
...@@ -286,7 +285,7 @@ add_handler (start_pc, end_pc, handler, type) ...@@ -286,7 +285,7 @@ add_handler (start_pc, end_pc, handler, type)
prev = ptr; prev = ptr;
} }
h = (struct eh_range *) xmalloc (sizeof (struct eh_range)); h = xmalloc (sizeof (struct eh_range));
h->start_pc = start_pc; h->start_pc = start_pc;
h->end_pc = end_pc; h->end_pc = end_pc;
h->first_child = NULL; h->first_child = NULL;
......
...@@ -834,13 +834,13 @@ DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags), ...@@ -834,13 +834,13 @@ DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags),
{ {
struct method_name *nn; struct method_name *nn;
nn = (struct method_name *) xmalloc (sizeof (struct method_name)); nn = xmalloc (sizeof (struct method_name));
nn->name = (char *) xmalloc (length); nn->name = xmalloc (length);
memcpy (nn->name, str, length); memcpy (nn->name, str, length);
nn->length = length; nn->length = length;
nn->next = method_name_list; nn->next = method_name_list;
nn->sig_length = JPOOL_UTF_LENGTH (jcf, sig_index); nn->sig_length = JPOOL_UTF_LENGTH (jcf, sig_index);
nn->signature = (char *) xmalloc (nn->sig_length); nn->signature = xmalloc (nn->sig_length);
memcpy (nn->signature, JPOOL_UTF_DATA (jcf, sig_index), memcpy (nn->signature, JPOOL_UTF_DATA (jcf, sig_index),
nn->sig_length); nn->sig_length);
method_name_list = nn; method_name_list = nn;
...@@ -1151,7 +1151,7 @@ throwable_p (clname) ...@@ -1151,7 +1151,7 @@ throwable_p (clname)
for (length = 0; clname[length] != ';' && clname[length] != '\0'; ++length) for (length = 0; clname[length] != ';' && clname[length] != '\0'; ++length)
; ;
current = (unsigned char *) ALLOC (length); current = ALLOC (length);
for (i = 0; i < length; ++i) for (i = 0; i < length; ++i)
current[i] = clname[i] == '/' ? '.' : clname[i]; current[i] = clname[i] == '/' ? '.' : clname[i];
current[length] = '\0'; current[length] = '\0';
...@@ -1189,7 +1189,7 @@ throwable_p (clname) ...@@ -1189,7 +1189,7 @@ throwable_p (clname)
jcf_parse_class (&jcf); jcf_parse_class (&jcf);
tmp = (unsigned char *) super_class_name (&jcf, &super_length); tmp = (unsigned char *) super_class_name (&jcf, &super_length);
super = (unsigned char *) ALLOC (super_length + 1); super = ALLOC (super_length + 1);
memcpy (super, tmp, super_length); memcpy (super, tmp, super_length);
super[super_length] = '\0'; super[super_length] = '\0';
...@@ -1733,7 +1733,7 @@ print_include (out, utf8, len) ...@@ -1733,7 +1733,7 @@ print_include (out, utf8, len)
return; return;
} }
incl = (struct include *) xmalloc (sizeof (struct include)); incl = xmalloc (sizeof (struct include));
incl->name = xmalloc (len + 1); incl->name = xmalloc (len + 1);
strncpy (incl->name, utf8, len); strncpy (incl->name, utf8, len);
incl->name[len] = '\0'; incl->name[len] = '\0';
...@@ -1820,7 +1820,7 @@ add_namelet (name, name_limit, parent) ...@@ -1820,7 +1820,7 @@ add_namelet (name, name_limit, parent)
if (n == NULL) if (n == NULL)
{ {
n = (struct namelet *) xmalloc (sizeof (struct namelet)); n = xmalloc (sizeof (struct namelet));
n->name = xmalloc (p - name + 1); n->name = xmalloc (p - name + 1);
strncpy (n->name, name, p - name); strncpy (n->name, name, p - name);
n->name[p - name] = '\0'; n->name[p - name] = '\0';
...@@ -2376,25 +2376,25 @@ DEFUN(main, (argc, argv), ...@@ -2376,25 +2376,25 @@ DEFUN(main, (argc, argv),
case OPT_PREPEND: case OPT_PREPEND:
if (prepend_count == 0) if (prepend_count == 0)
prepend_specs = (char**) ALLOC (argc * sizeof (char*)); prepend_specs = ALLOC (argc * sizeof (char*));
prepend_specs[prepend_count++] = optarg; prepend_specs[prepend_count++] = optarg;
break; break;
case OPT_FRIEND: case OPT_FRIEND:
if (friend_count == 0) if (friend_count == 0)
friend_specs = (char**) ALLOC (argc * sizeof (char*)); friend_specs = ALLOC (argc * sizeof (char*));
friend_specs[friend_count++] = optarg; friend_specs[friend_count++] = optarg;
break; break;
case OPT_ADD: case OPT_ADD:
if (add_count == 0) if (add_count == 0)
add_specs = (char**) ALLOC (argc * sizeof (char*)); add_specs = ALLOC (argc * sizeof (char*));
add_specs[add_count++] = optarg; add_specs[add_count++] = optarg;
break; break;
case OPT_APPEND: case OPT_APPEND:
if (append_count == 0) if (append_count == 0)
append_specs = (char**) ALLOC (argc * sizeof (char*)); append_specs = ALLOC (argc * sizeof (char*));
append_specs[append_count++] = optarg; append_specs[append_count++] = optarg;
break; break;
...@@ -2481,7 +2481,7 @@ DEFUN(main, (argc, argv), ...@@ -2481,7 +2481,7 @@ DEFUN(main, (argc, argv),
{ {
int dir_len = strlen (output_directory); int dir_len = strlen (output_directory);
int i, classname_length = strlen (classname); int i, classname_length = strlen (classname);
current_output_file = (char*) ALLOC (dir_len + classname_length + 5); current_output_file = ALLOC (dir_len + classname_length + 5);
strcpy (current_output_file, output_directory); strcpy (current_output_file, output_directory);
if (dir_len > 0 && output_directory[dir_len-1] != '/') if (dir_len > 0 && output_directory[dir_len-1] != '/')
current_output_file[dir_len++] = '/'; current_output_file[dir_len++] = '/';
......
...@@ -455,10 +455,10 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok), ...@@ -455,10 +455,10 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok),
/* Allocate and zero out the buffer, since we don't explicitly put a /* Allocate and zero out the buffer, since we don't explicitly put a
null pointer when we're copying it below. */ null pointer when we're copying it below. */
buflen = jcf_path_max_len () + classname_length + 10; buflen = jcf_path_max_len () + classname_length + 10;
buffer = (char *) ALLOC (buflen); buffer = ALLOC (buflen);
memset (buffer, 0, buflen); memset (buffer, 0, buflen);
java_buffer = (char *) alloca (buflen); java_buffer = alloca (buflen);
jcf->java_source = 0; jcf->java_source = 0;
......
...@@ -708,7 +708,7 @@ void ...@@ -708,7 +708,7 @@ void
init_outgoing_cpool () init_outgoing_cpool ()
{ {
current_constant_pool_data_ref = NULL_TREE; current_constant_pool_data_ref = NULL_TREE;
outgoing_cpool = (struct CPool *)xmalloc (sizeof (struct CPool)); outgoing_cpool = xmalloc (sizeof (struct CPool));
memset (outgoing_cpool, 0, sizeof (struct CPool)); memset (outgoing_cpool, 0, sizeof (struct CPool));
} }
...@@ -1059,7 +1059,7 @@ java_parse_file (set_yydebug) ...@@ -1059,7 +1059,7 @@ java_parse_file (set_yydebug)
fatal_io_error ("can't open %s", IDENTIFIER_POINTER (name)); fatal_io_error ("can't open %s", IDENTIFIER_POINTER (name));
#ifdef IO_BUFFER_SIZE #ifdef IO_BUFFER_SIZE
setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), setvbuf (finput, xmalloc (IO_BUFFER_SIZE),
_IOFBF, IO_BUFFER_SIZE); _IOFBF, IO_BUFFER_SIZE);
#endif #endif
input_filename = IDENTIFIER_POINTER (name); input_filename = IDENTIFIER_POINTER (name);
......
...@@ -143,7 +143,7 @@ add_entry (entp, filename, is_system) ...@@ -143,7 +143,7 @@ add_entry (entp, filename, is_system)
int len; int len;
struct entry *n; struct entry *n;
n = (struct entry *) ALLOC (sizeof (struct entry)); n = ALLOC (sizeof (struct entry));
n->flags = is_system ? FLAG_SYSTEM : 0; n->flags = is_system ? FLAG_SYSTEM : 0;
n->next = NULL; n->next = NULL;
...@@ -165,7 +165,7 @@ add_entry (entp, filename, is_system) ...@@ -165,7 +165,7 @@ add_entry (entp, filename, is_system)
work more easily. Eww. */ work more easily. Eww. */
if (filename[len - 1] != '/' && filename[len - 1] != DIR_SEPARATOR) if (filename[len - 1] != '/' && filename[len - 1] != DIR_SEPARATOR)
{ {
char *f2 = (char *) alloca (len + 2); char *f2 = alloca (len + 2);
strcpy (f2, filename); strcpy (f2, filename);
f2[len] = DIR_SEPARATOR; f2[len] = DIR_SEPARATOR;
f2[len + 1] = '\0'; f2[len + 1] = '\0';
...@@ -191,7 +191,7 @@ add_path (entp, cp, is_system) ...@@ -191,7 +191,7 @@ add_path (entp, cp, is_system)
if (cp) if (cp)
{ {
char *buf = (char *) alloca (strlen (cp) + 3); char *buf = alloca (strlen (cp) + 3);
startp = endp = cp; startp = endp = cp;
while (1) while (1)
{ {
...@@ -299,7 +299,7 @@ jcf_path_init () ...@@ -299,7 +299,7 @@ jcf_path_init ()
/* Desperation: use the installed one. */ /* Desperation: use the installed one. */
char *extdirs; char *extdirs;
add_entry (&sys_dirs, LIBGCJ_ZIP_FILE, 1); add_entry (&sys_dirs, LIBGCJ_ZIP_FILE, 1);
extdirs = (char *) alloca (strlen (LIBGCJ_ZIP_FILE) + 1); extdirs = alloca (strlen (LIBGCJ_ZIP_FILE) + 1);
strcpy (extdirs, LIBGCJ_ZIP_FILE); strcpy (extdirs, LIBGCJ_ZIP_FILE);
strcpy (&extdirs[strlen (LIBGCJ_ZIP_FILE) strcpy (&extdirs[strlen (LIBGCJ_ZIP_FILE)
- strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")], - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],
...@@ -346,7 +346,7 @@ jcf_path_extdirs_arg (cp) ...@@ -346,7 +346,7 @@ jcf_path_extdirs_arg (cp)
if (cp) if (cp)
{ {
char *buf = (char *) alloca (strlen (cp) + 3); char *buf = alloca (strlen (cp) + 3);
startp = endp = cp; startp = endp = cp;
while (1) while (1)
{ {
...@@ -375,9 +375,8 @@ jcf_path_extdirs_arg (cp) ...@@ -375,9 +375,8 @@ jcf_path_extdirs_arg (cp)
if (direntp->d_name[0] != '.') if (direntp->d_name[0] != '.')
{ {
char *name = char *name = alloca (dirname_length
(char *) alloca (dirname_length + strlen (direntp->d_name) + 2);
+ strlen (direntp->d_name) + 2);
strcpy (name, buf); strcpy (name, buf);
if (name[dirname_length-1] != DIR_SEPARATOR) if (name[dirname_length-1] != DIR_SEPARATOR)
{ {
......
...@@ -88,8 +88,8 @@ find_spec_file (dir) ...@@ -88,8 +88,8 @@ find_spec_file (dir)
int x; int x;
struct stat sb; struct stat sb;
spec = (char *) xmalloc (strlen (dir) + sizeof (SPEC_FILE) spec = xmalloc (strlen (dir) + sizeof (SPEC_FILE)
+ sizeof ("-specs=") + 4); + sizeof ("-specs=") + 4);
strcpy (spec, "-specs="); strcpy (spec, "-specs=");
x = strlen (spec); x = strlen (spec);
strcat (spec, dir); strcat (spec, dir);
...@@ -251,7 +251,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -251,7 +251,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
argv = *in_argv; argv = *in_argv;
added_libraries = *in_added_libraries; added_libraries = *in_added_libraries;
args = (int *) xcalloc (argc, sizeof (int)); args = xcalloc (argc, sizeof (int));
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
{ {
...@@ -496,7 +496,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -496,7 +496,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
num_args += shared_libgcc; num_args += shared_libgcc;
arglist = (const char **) xmalloc ((num_args + 1) * sizeof (char *)); arglist = xmalloc ((num_args + 1) * sizeof (char *));
j = 0; j = 0;
for (i = 0; i < argc; i++, j++) for (i = 0; i < argc; i++, j++)
......
...@@ -559,8 +559,8 @@ java_init (filename) ...@@ -559,8 +559,8 @@ java_init (filename)
error ("couldn't determine target name for dependency tracking"); error ("couldn't determine target name for dependency tracking");
else else
{ {
char *buf = (char *) xmalloc (dot - filename + char *buf = xmalloc (dot - filename +
3 + sizeof (TARGET_OBJECT_SUFFIX)); 3 + sizeof (TARGET_OBJECT_SUFFIX));
strncpy (buf, filename, dot - filename); strncpy (buf, filename, dot - filename);
/* If emitting class files, we might have multiple /* If emitting class files, we might have multiple
...@@ -633,12 +633,12 @@ put_decl_string (str, len) ...@@ -633,12 +633,12 @@ put_decl_string (str, len)
if (decl_buf == NULL) if (decl_buf == NULL)
{ {
decl_buflen = len + 100; decl_buflen = len + 100;
decl_buf = (char *) xmalloc (decl_buflen); decl_buf = xmalloc (decl_buflen);
} }
else else
{ {
decl_buflen *= 2; decl_buflen *= 2;
decl_buf = (char *) xrealloc (decl_buf, decl_buflen); decl_buf = xrealloc (decl_buf, decl_buflen);
} }
} }
strcpy (decl_buf + decl_bufpos, str); strcpy (decl_buf + decl_bufpos, str);
......
...@@ -128,8 +128,8 @@ java_init_lex (finput, encoding) ...@@ -128,8 +128,8 @@ java_init_lex (finput, encoding)
CPC_INITIALIZER_LIST (ctxp) = CPC_STATIC_INITIALIZER_LIST (ctxp) = CPC_INITIALIZER_LIST (ctxp) = CPC_STATIC_INITIALIZER_LIST (ctxp) =
CPC_INSTANCE_INITIALIZER_LIST (ctxp) = NULL_TREE; CPC_INSTANCE_INITIALIZER_LIST (ctxp) = NULL_TREE;
memset ((PTR) ctxp->modifier_ctx, 0, sizeof (ctxp->modifier_ctx)); memset (ctxp->modifier_ctx, 0, sizeof (ctxp->modifier_ctx));
memset ((PTR) current_jcf, 0, sizeof (JCF)); memset (current_jcf, 0, sizeof (JCF));
ctxp->current_parsed_class = NULL; ctxp->current_parsed_class = NULL;
ctxp->package = NULL_TREE; ctxp->package = NULL_TREE;
#endif #endif
...@@ -196,12 +196,11 @@ java_allocate_new_line () ...@@ -196,12 +196,11 @@ java_allocate_new_line ()
if (!ctxp->c_line) if (!ctxp->c_line)
{ {
ctxp->c_line = (struct java_line *)xmalloc (sizeof (struct java_line)); ctxp->c_line = xmalloc (sizeof (struct java_line));
ctxp->c_line->max = JAVA_LINE_MAX; ctxp->c_line->max = JAVA_LINE_MAX;
ctxp->c_line->line = (unicode_t *)xmalloc ctxp->c_line->line = xmalloc (sizeof (unicode_t)*ctxp->c_line->max);
(sizeof (unicode_t)*ctxp->c_line->max);
ctxp->c_line->unicode_escape_p = ctxp->c_line->unicode_escape_p =
(char *)xmalloc (sizeof (char)*ctxp->c_line->max); xmalloc (sizeof (char)*ctxp->c_line->max);
ctxp->c_line->white_space_only = 0; ctxp->c_line->white_space_only = 0;
} }
...@@ -226,7 +225,7 @@ java_new_lexer (finput, encoding) ...@@ -226,7 +225,7 @@ java_new_lexer (finput, encoding)
FILE *finput; FILE *finput;
const char *encoding; const char *encoding;
{ {
java_lexer *lex = (java_lexer *) xmalloc (sizeof (java_lexer)); java_lexer *lex = xmalloc (sizeof (java_lexer));
int enc_error = 0; int enc_error = 0;
lex->finput = finput; lex->finput = finput;
...@@ -522,9 +521,9 @@ java_store_unicode (l, c, unicode_escape_p) ...@@ -522,9 +521,9 @@ java_store_unicode (l, c, unicode_escape_p)
if (l->size == l->max) if (l->size == l->max)
{ {
l->max += JAVA_LINE_MAX; l->max += JAVA_LINE_MAX;
l->line = (unicode_t *) xrealloc (l->line, sizeof (unicode_t)*l->max); l->line = xrealloc (l->line, sizeof (unicode_t)*l->max);
l->unicode_escape_p = (char *) xrealloc (l->unicode_escape_p, l->unicode_escape_p = xrealloc (l->unicode_escape_p,
sizeof (char)*l->max); sizeof (char)*l->max);
} }
l->line [l->size] = c; l->line [l->size] = c;
l->unicode_escape_p [l->size++] = unicode_escape_p; l->unicode_escape_p [l->size++] = unicode_escape_p;
......
...@@ -449,7 +449,7 @@ verify_jvm_instructions (jcf, byte_ops, length) ...@@ -449,7 +449,7 @@ verify_jvm_instructions (jcf, byte_ops, length)
/* We read the exception handlers in order of increasing start PC. /* We read the exception handlers in order of increasing start PC.
To do this we first read and sort the start PCs. */ To do this we first read and sort the start PCs. */
starts = (struct pc_index *) xmalloc (eh_count * sizeof (struct pc_index)); starts = xmalloc (eh_count * sizeof (struct pc_index));
for (i = 0; i < eh_count; ++i) for (i = 0; i < eh_count; ++i)
{ {
starts[i].start_pc = GET_u2 (jcf->read_ptr + 8 * i); starts[i].start_pc = GET_u2 (jcf->read_ptr + 8 * i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment