diff options
author | Tom de Vries <tdevries@suse.de> | 2023-08-31 09:37:44 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-08-31 09:37:44 +0200 |
commit | 959db212304e64751563bcaaacbdd28efd5016a7 (patch) | |
tree | 425a452907842c0bfd488b23a870148e4f731a41 /gdb/gdbtypes.c | |
parent | 6d3c2d749be8fe1be7d7ba11596e40531cf3cf7c (diff) | |
download | gdb-959db212304e64751563bcaaacbdd28efd5016a7.zip gdb-959db212304e64751563bcaaacbdd28efd5016a7.tar.gz gdb-959db212304e64751563bcaaacbdd28efd5016a7.tar.bz2 |
[gdb/symtab] Replace TYPE_ALLOC with TYPE_ZALLOC where required
Handle the remaining uses of TYPE_ALLOC, either by:
- replacing with TYPE_ZALLOC, or
- adding a comment explaining why zero-initialization is not necessary.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r-- | gdb/gdbtypes.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 65da995..6abe5ea 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3207,7 +3207,7 @@ check_stub_method (struct type *type, int method_id, int signature_id) /* We need one extra slot, for the THIS pointer. */ argtypes = (struct field *) - TYPE_ALLOC (type, (argcount + 1) * sizeof (struct field)); + TYPE_ZALLOC (type, (argcount + 1) * sizeof (struct field)); p = argtypetext; /* Add THIS pointer for non-static methods. */ @@ -3297,7 +3297,7 @@ allocate_cplus_struct_type (struct type *type) TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_CPLUS_STUFF; TYPE_RAW_CPLUS_SPECIFIC (type) = (struct cplus_struct_type *) - TYPE_ALLOC (type, sizeof (struct cplus_struct_type)); + TYPE_ZALLOC (type, sizeof (struct cplus_struct_type)); *(TYPE_RAW_CPLUS_SPECIFIC (type)) = cplus_struct_default; set_type_vptr_fieldno (type, -1); } @@ -3314,7 +3314,7 @@ allocate_gnat_aux_type (struct type *type) { TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_GNAT_STUFF; TYPE_GNAT_SPECIFIC (type) = (struct gnat_aux_type *) - TYPE_ALLOC (type, sizeof (struct gnat_aux_type)); + TYPE_ZALLOC (type, sizeof (struct gnat_aux_type)); *(TYPE_GNAT_SPECIFIC (type)) = gnat_aux_default; } @@ -3454,6 +3454,8 @@ init_complex_type (const char *name, struct type *target_type) { if (name == nullptr && target_type->name () != nullptr) { + /* No zero-initialization required, initialized by strcpy/strcat + below. */ char *new_name = (char *) TYPE_ALLOC (target_type, strlen (target_type->name ()) |