Skip to content

Commit abd3d46

Browse files
committed
8382401: Remove return type parameters from FREE_ and REALLOC_ macros
Reviewed-by: tschatzl, dholmes
1 parent 9a689b0 commit abd3d46

184 files changed

Lines changed: 435 additions & 439 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/hotspot/cpu/x86/vm_version_x86.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2527,7 +2527,7 @@ const char* VM_Version::cpu_brand_string(void) {
25272527
}
25282528
int ret_val = cpu_extended_brand_string(_cpu_brand_string, CPU_EBS_MAX_LENGTH);
25292529
if (ret_val != OS_OK) {
2530-
FREE_C_HEAP_ARRAY(char, _cpu_brand_string);
2530+
FREE_C_HEAP_ARRAY(_cpu_brand_string);
25312531
_cpu_brand_string = nullptr;
25322532
}
25332533
}

src/hotspot/os/aix/os_aix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,13 @@ void os::init_system_properties_values() {
578578
char *ld_library_path = NEW_C_HEAP_ARRAY(char, pathsize, mtInternal);
579579
os::snprintf_checked(ld_library_path, pathsize, "%s%s" DEFAULT_LIBPATH, v, v_colon);
580580
Arguments::set_library_path(ld_library_path);
581-
FREE_C_HEAP_ARRAY(char, ld_library_path);
581+
FREE_C_HEAP_ARRAY(ld_library_path);
582582

583583
// Extensions directories.
584584
os::snprintf_checked(buf, bufsize, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
585585
Arguments::set_ext_dirs(buf);
586586

587-
FREE_C_HEAP_ARRAY(char, buf);
587+
FREE_C_HEAP_ARRAY(buf);
588588

589589
#undef DEFAULT_LIBPATH
590590
#undef EXTENSIONS_DIR

src/hotspot/os/aix/os_perf_aix.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ bool CPUPerformanceInterface::CPUPerformance::initialize() {
258258

259259
CPUPerformanceInterface::CPUPerformance::~CPUPerformance() {
260260
if (_lcpu_names) {
261-
FREE_C_HEAP_ARRAY(perfstat_id_t, _lcpu_names);
261+
FREE_C_HEAP_ARRAY(_lcpu_names);
262262
}
263263
if (_prev_ticks) {
264-
FREE_C_HEAP_ARRAY(cpu_tick_store_t, _prev_ticks);
264+
FREE_C_HEAP_ARRAY(_prev_ticks);
265265
}
266266
}
267267

@@ -511,12 +511,12 @@ CPUInformationInterface::~CPUInformationInterface() {
511511
if (_cpu_info != nullptr) {
512512
if (_cpu_info->cpu_name() != nullptr) {
513513
const char* cpu_name = _cpu_info->cpu_name();
514-
FREE_C_HEAP_ARRAY(char, cpu_name);
514+
FREE_C_HEAP_ARRAY(cpu_name);
515515
_cpu_info->set_cpu_name(nullptr);
516516
}
517517
if (_cpu_info->cpu_description() != nullptr) {
518518
const char* cpu_desc = _cpu_info->cpu_description();
519-
FREE_C_HEAP_ARRAY(char, cpu_desc);
519+
FREE_C_HEAP_ARRAY(cpu_desc);
520520
_cpu_info->set_cpu_description(nullptr);
521521
}
522522
delete _cpu_info;
@@ -576,7 +576,7 @@ int NetworkPerformanceInterface::NetworkPerformance::network_utilization(Network
576576

577577
// check for error
578578
if (n_records < 0) {
579-
FREE_C_HEAP_ARRAY(perfstat_netinterface_t, net_stats);
579+
FREE_C_HEAP_ARRAY(net_stats);
580580
return OS_ERR;
581581
}
582582

@@ -593,7 +593,7 @@ int NetworkPerformanceInterface::NetworkPerformance::network_utilization(Network
593593
*network_interfaces = new_interface;
594594
}
595595

596-
FREE_C_HEAP_ARRAY(perfstat_netinterface_t, net_stats);
596+
FREE_C_HEAP_ARRAY(net_stats);
597597
return OS_OK;
598598
}
599599

src/hotspot/os/bsd/os_bsd.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,14 @@ void os::init_system_properties_values() {
444444
char *ld_library_path = NEW_C_HEAP_ARRAY(char, ld_library_path_size, mtInternal);
445445
os::snprintf_checked(ld_library_path, ld_library_path_size, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch);
446446
Arguments::set_library_path(ld_library_path);
447-
FREE_C_HEAP_ARRAY(char, ld_library_path);
447+
FREE_C_HEAP_ARRAY(ld_library_path);
448448
}
449449

450450
// Extensions directories.
451451
os::snprintf_checked(buf, bufsize, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
452452
Arguments::set_ext_dirs(buf);
453453

454-
FREE_C_HEAP_ARRAY(char, buf);
454+
FREE_C_HEAP_ARRAY(buf);
455455

456456
#else // __APPLE__
457457

@@ -538,7 +538,7 @@ void os::init_system_properties_values() {
538538
os::snprintf_checked(ld_library_path, ld_library_path_size, "%s%s%s%s%s" SYS_EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS ":.",
539539
v, v_colon, l, l_colon, user_home_dir);
540540
Arguments::set_library_path(ld_library_path);
541-
FREE_C_HEAP_ARRAY(char, ld_library_path);
541+
FREE_C_HEAP_ARRAY(ld_library_path);
542542
}
543543

544544
// Extensions directories.
@@ -550,7 +550,7 @@ void os::init_system_properties_values() {
550550
user_home_dir, Arguments::get_java_home());
551551
Arguments::set_ext_dirs(buf);
552552

553-
FREE_C_HEAP_ARRAY(char, buf);
553+
FREE_C_HEAP_ARRAY(buf);
554554

555555
#undef SYS_EXTENSIONS_DIR
556556
#undef SYS_EXTENSIONS_DIRS

src/hotspot/os/bsd/os_perf_bsd.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ int SystemProcessInterface::SystemProcesses::system_processes(SystemProcess** sy
301301
pids_bytes = proc_listpids(PROC_ALL_PIDS, 0, pids, pids_bytes);
302302
if (pids_bytes <= 0) {
303303
// couldn't fit buffer, retry.
304-
FREE_RESOURCE_ARRAY(pid_t, pids, pid_count);
304+
FREE_RESOURCE_ARRAY(pids, pid_count);
305305
pids = nullptr;
306306
try_count++;
307307
if (try_count > 3) {
@@ -381,12 +381,12 @@ CPUInformationInterface::~CPUInformationInterface() {
381381
if (_cpu_info != nullptr) {
382382
if (_cpu_info->cpu_name() != nullptr) {
383383
const char* cpu_name = _cpu_info->cpu_name();
384-
FREE_C_HEAP_ARRAY(char, cpu_name);
384+
FREE_C_HEAP_ARRAY(cpu_name);
385385
_cpu_info->set_cpu_name(nullptr);
386386
}
387387
if (_cpu_info->cpu_description() != nullptr) {
388388
const char* cpu_desc = _cpu_info->cpu_description();
389-
FREE_C_HEAP_ARRAY(char, cpu_desc);
389+
FREE_C_HEAP_ARRAY(cpu_desc);
390390
_cpu_info->set_cpu_description(nullptr);
391391
}
392392
delete _cpu_info;

src/hotspot/os/linux/os_linux.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,14 +710,14 @@ void os::init_system_properties_values() {
710710
char *ld_library_path = NEW_C_HEAP_ARRAY(char, pathsize, mtInternal);
711711
os::snprintf_checked(ld_library_path, pathsize, "%s%s" SYS_EXT_DIR "/lib:" DEFAULT_LIBPATH, v, v_colon);
712712
Arguments::set_library_path(ld_library_path);
713-
FREE_C_HEAP_ARRAY(char, ld_library_path);
713+
FREE_C_HEAP_ARRAY(ld_library_path);
714714
}
715715

716716
// Extensions directories.
717717
os::snprintf_checked(buf, bufsize, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
718718
Arguments::set_ext_dirs(buf);
719719

720-
FREE_C_HEAP_ARRAY(char, buf);
720+
FREE_C_HEAP_ARRAY(buf);
721721

722722
#undef DEFAULT_LIBPATH
723723
#undef SYS_EXT_DIR
@@ -3435,7 +3435,7 @@ void os::Linux::rebuild_cpu_to_node_map() {
34353435
}
34363436
}
34373437
}
3438-
FREE_C_HEAP_ARRAY(unsigned long, cpu_map);
3438+
FREE_C_HEAP_ARRAY(cpu_map);
34393439
}
34403440

34413441
int os::Linux::numa_node_to_cpus(int node, unsigned long *buffer, int bufferlen) {

src/hotspot/os/linux/os_perf_linux.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ bool CPUPerformanceInterface::CPUPerformance::initialize() {
545545

546546
CPUPerformanceInterface::CPUPerformance::~CPUPerformance() {
547547
if (_counters.cpus != nullptr) {
548-
FREE_C_HEAP_ARRAY(char, _counters.cpus);
548+
FREE_C_HEAP_ARRAY(_counters.cpus);
549549
}
550550
}
551551

@@ -811,7 +811,7 @@ int SystemProcessInterface::SystemProcesses::ProcessIterator::current(SystemProc
811811
cmdline = get_cmdline();
812812
if (cmdline != nullptr) {
813813
process_info->set_command_line(allocate_string(cmdline));
814-
FREE_C_HEAP_ARRAY(char, cmdline);
814+
FREE_C_HEAP_ARRAY(cmdline);
815815
}
816816

817817
return OS_OK;
@@ -937,12 +937,12 @@ CPUInformationInterface::~CPUInformationInterface() {
937937
if (_cpu_info != nullptr) {
938938
if (_cpu_info->cpu_name() != nullptr) {
939939
const char* cpu_name = _cpu_info->cpu_name();
940-
FREE_C_HEAP_ARRAY(char, cpu_name);
940+
FREE_C_HEAP_ARRAY(cpu_name);
941941
_cpu_info->set_cpu_name(nullptr);
942942
}
943943
if (_cpu_info->cpu_description() != nullptr) {
944944
const char* cpu_desc = _cpu_info->cpu_description();
945-
FREE_C_HEAP_ARRAY(char, cpu_desc);
945+
FREE_C_HEAP_ARRAY(cpu_desc);
946946
_cpu_info->set_cpu_description(nullptr);
947947
}
948948
delete _cpu_info;

src/hotspot/os/linux/procMapsParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ProcSmapsParser::ProcSmapsParser(FILE* f) :
4545
}
4646

4747
ProcSmapsParser::~ProcSmapsParser() {
48-
FREE_C_HEAP_ARRAY(char, _line);
48+
FREE_C_HEAP_ARRAY(_line);
4949
}
5050

5151
bool ProcSmapsParser::read_line() {

src/hotspot/os/posix/perfMemory_posix.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static void save_memory_to_file(char* addr, size_t size) {
118118
}
119119
}
120120
}
121-
FREE_C_HEAP_ARRAY(char, destfile);
121+
FREE_C_HEAP_ARRAY(destfile);
122122
}
123123

124124

@@ -483,14 +483,14 @@ static char* get_user_name(uid_t uid) {
483483
p->pw_name == nullptr ? "pw_name = null" : "pw_name zero length");
484484
}
485485
}
486-
FREE_C_HEAP_ARRAY(char, pwbuf);
486+
FREE_C_HEAP_ARRAY(pwbuf);
487487
return nullptr;
488488
}
489489

490490
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
491491
strcpy(user_name, p->pw_name);
492492

493-
FREE_C_HEAP_ARRAY(char, pwbuf);
493+
FREE_C_HEAP_ARRAY(pwbuf);
494494
return user_name;
495495
}
496496

@@ -572,7 +572,7 @@ static char* get_user_name_slow(int vmid, int nspid, TRAPS) {
572572
DIR* subdirp = open_directory_secure(usrdir_name);
573573

574574
if (subdirp == nullptr) {
575-
FREE_C_HEAP_ARRAY(char, usrdir_name);
575+
FREE_C_HEAP_ARRAY(usrdir_name);
576576
continue;
577577
}
578578

@@ -583,7 +583,7 @@ static char* get_user_name_slow(int vmid, int nspid, TRAPS) {
583583
// symlink can be exploited.
584584
//
585585
if (!is_directory_secure(usrdir_name)) {
586-
FREE_C_HEAP_ARRAY(char, usrdir_name);
586+
FREE_C_HEAP_ARRAY(usrdir_name);
587587
os::closedir(subdirp);
588588
continue;
589589
}
@@ -607,13 +607,13 @@ static char* get_user_name_slow(int vmid, int nspid, TRAPS) {
607607
// don't follow symbolic links for the file
608608
RESTARTABLE(::lstat(filename, &statbuf), result);
609609
if (result == OS_ERR) {
610-
FREE_C_HEAP_ARRAY(char, filename);
610+
FREE_C_HEAP_ARRAY(filename);
611611
continue;
612612
}
613613

614614
// skip over files that are not regular files.
615615
if (!S_ISREG(statbuf.st_mode)) {
616-
FREE_C_HEAP_ARRAY(char, filename);
616+
FREE_C_HEAP_ARRAY(filename);
617617
continue;
618618
}
619619

@@ -623,19 +623,19 @@ static char* get_user_name_slow(int vmid, int nspid, TRAPS) {
623623
if (statbuf.st_ctime > oldest_ctime) {
624624
char* user = strchr(dentry->d_name, '_') + 1;
625625

626-
FREE_C_HEAP_ARRAY(char, oldest_user);
626+
FREE_C_HEAP_ARRAY(oldest_user);
627627
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
628628

629629
strcpy(oldest_user, user);
630630
oldest_ctime = statbuf.st_ctime;
631631
}
632632
}
633633

634-
FREE_C_HEAP_ARRAY(char, filename);
634+
FREE_C_HEAP_ARRAY(filename);
635635
}
636636
}
637637
os::closedir(subdirp);
638-
FREE_C_HEAP_ARRAY(char, usrdir_name);
638+
FREE_C_HEAP_ARRAY(usrdir_name);
639639
}
640640
os::closedir(tmpdirp);
641641

@@ -1105,11 +1105,11 @@ static char* mmap_create_shared(size_t size) {
11051105
log_info(perf, memops)("Trying to open %s/%s", dirname, short_filename);
11061106
fd = create_sharedmem_file(dirname, short_filename, size);
11071107

1108-
FREE_C_HEAP_ARRAY(char, user_name);
1109-
FREE_C_HEAP_ARRAY(char, dirname);
1108+
FREE_C_HEAP_ARRAY(user_name);
1109+
FREE_C_HEAP_ARRAY(dirname);
11101110

11111111
if (fd == -1) {
1112-
FREE_C_HEAP_ARRAY(char, filename);
1112+
FREE_C_HEAP_ARRAY(filename);
11131113
return nullptr;
11141114
}
11151115

@@ -1121,7 +1121,7 @@ static char* mmap_create_shared(size_t size) {
11211121
if (mapAddress == MAP_FAILED) {
11221122
log_debug(perf)("mmap failed - %s", os::strerror(errno));
11231123
remove_file(filename);
1124-
FREE_C_HEAP_ARRAY(char, filename);
1124+
FREE_C_HEAP_ARRAY(filename);
11251125
return nullptr;
11261126
}
11271127

@@ -1171,7 +1171,7 @@ static void delete_shared_memory(char* addr, size_t size) {
11711171
remove_file(backing_store_file_name);
11721172
// Don't.. Free heap memory could deadlock os::abort() if it is called
11731173
// from signal handler. OS will reclaim the heap memory.
1174-
// FREE_C_HEAP_ARRAY(char, backing_store_file_name);
1174+
// FREE_C_HEAP_ARRAY(backing_store_file_name);
11751175
backing_store_file_name = nullptr;
11761176
}
11771177
}
@@ -1223,8 +1223,8 @@ static void mmap_attach_shared(int vmid, char** addr, size_t* sizep, TRAPS) {
12231223
// store file, we don't follow them when attaching either.
12241224
//
12251225
if (!is_directory_secure(dirname)) {
1226-
FREE_C_HEAP_ARRAY(char, dirname);
1227-
FREE_C_HEAP_ARRAY(char, luser);
1226+
FREE_C_HEAP_ARRAY(dirname);
1227+
FREE_C_HEAP_ARRAY(luser);
12281228
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
12291229
"Process not found");
12301230
}
@@ -1236,9 +1236,9 @@ static void mmap_attach_shared(int vmid, char** addr, size_t* sizep, TRAPS) {
12361236
int fd = open_sharedmem_file(filename, file_flags, THREAD);
12371237

12381238
// free the c heap resources that are no longer needed
1239-
FREE_C_HEAP_ARRAY(char, luser);
1240-
FREE_C_HEAP_ARRAY(char, dirname);
1241-
FREE_C_HEAP_ARRAY(char, filename);
1239+
FREE_C_HEAP_ARRAY(luser);
1240+
FREE_C_HEAP_ARRAY(dirname);
1241+
FREE_C_HEAP_ARRAY(filename);
12421242

12431243
if (HAS_PENDING_EXCEPTION) {
12441244
assert(fd == OS_ERR, "open_sharedmem_file always return OS_ERR on exceptions");

0 commit comments

Comments
 (0)