Skip to content

Commit

Permalink
8298205: Prefer Member Initialization Lists for JFR classes in os_per…
Browse files Browse the repository at this point in the history
…f.hpp

Reviewed-by: dholmes, mgronlun
  • Loading branch information
Tyler Steele committed Dec 7, 2022
1 parent 389b8f4 commit 3934484
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions src/hotspot/share/runtime/os_perf.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -40,13 +40,12 @@ class CPUInformation : public CHeapObj<mtInternal> {
const char* _name;

public:
CPUInformation() {
_no_of_sockets = 0;
_no_of_cores = 0;
_no_of_hw_threads = 0;
_description = NULL;
_name = NULL;
}
CPUInformation() :
_no_of_sockets(0),
_no_of_cores(0),
_no_of_hw_threads(0),
_description(nullptr),
_name(nullptr) {}

int number_of_sockets(void) const {
return _no_of_sockets;
Expand Down Expand Up @@ -98,21 +97,19 @@ class SystemProcess : public CHeapObj<mtInternal> {
SystemProcess* _next;

public:
SystemProcess() {
_pid = 0;
_name = NULL;
_path = NULL;
_command_line = NULL;
_next = NULL;
}

SystemProcess(int pid, char* name, char* path, char* command_line, SystemProcess* next) {
_pid = pid;
_name = name;
_path = path;
_command_line = command_line;
_next = next;
}
SystemProcess() :
_pid (0),
_name(nullptr),
_path(nullptr),
_command_line(nullptr),
_next(nullptr) {}

SystemProcess(int pid, char* name, char* path, char* command_line, SystemProcess* next) :
_pid(pid),
_name(name),
_path(path),
_command_line(command_line),
_next(next) {}

void set_next(SystemProcess* sys_process) {
_next = sys_process;
Expand Down Expand Up @@ -172,11 +169,11 @@ class NetworkInterface : public ResourceObj {

public:
NetworkInterface(const char* name, uint64_t bytes_in, uint64_t bytes_out, NetworkInterface* next) :
_name(NULL),
_name(nullptr),
_bytes_in(bytes_in),
_bytes_out(bytes_out),
_next(next) {
assert(name != NULL, "invariant");
assert(name != nullptr, "invariant");
const size_t length = strlen(name);
_name = NEW_RESOURCE_ARRAY(char, length + 1);
strncpy(_name, name, length + 1);
Expand Down

1 comment on commit 3934484

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.