Skip to content

Commit

Permalink
Replaced memnewOldNoConstructor macro with memnewNoConstructor function.
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterPuma80 committed Jan 17, 2025
1 parent 244ae07 commit 308b41d
Show file tree
Hide file tree
Showing 532 changed files with 5,315 additions and 5,315 deletions.
6 changes: 3 additions & 3 deletions core/crypto/hashing_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ void HashingContext::_create_ctx(HashType p_type) {
type = p_type;
switch (type) {
case HASH_MD5:
ctx = memnewOldNoConstructor(CryptoCore::MD5Context);
ctx = memnewNoConstructor<CryptoCore::MD5Context>();
break;
case HASH_SHA1:
ctx = memnewOldNoConstructor(CryptoCore::SHA1Context);
ctx = memnewNoConstructor<CryptoCore::SHA1Context>();
break;
case HASH_SHA256:
ctx = memnewOldNoConstructor(CryptoCore::SHA256Context);
ctx = memnewNoConstructor<CryptoCore::SHA256Context>();
break;
default:
ctx = nullptr;
Expand Down
6 changes: 3 additions & 3 deletions core/debugger/engine_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, co
return;
}
if (p_uri == "local://") {
singleton = memnewOldNoConstructor(LocalDebugger);
script_debugger = memnewOldNoConstructor(ScriptDebugger);
singleton = memnewNoConstructor<LocalDebugger>();
script_debugger = memnewNoConstructor<ScriptDebugger>();
// Tell the OS that we want to handle termination signals.
OS::get_singleton()->initialize_debugging();
} else if (p_uri.contains("://")) {
Expand All @@ -147,7 +147,7 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, co
return;
}
singleton = memnewOldWithArgs(RemoteDebugger(Ref<RemoteDebuggerPeer>(peer)));
script_debugger = memnewOldNoConstructor(ScriptDebugger);
script_debugger = memnewNoConstructor<ScriptDebugger>();
// Notify editor of our pid (to allow focus stealing).
Array msg;
msg.push_back(OS::get_singleton()->get_process_id());
Expand Down
2 changes: 1 addition & 1 deletion core/debugger/local_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ LocalDebugger::LocalDebugger() {
options["variable_prefix"] = "";

// Bind scripts profiler.
scripts_profiler = memnewOldNoConstructor(ScriptsProfiler);
scripts_profiler = memnewNoConstructor<ScriptsProfiler>();
Profiler scr_prof(
scripts_profiler,
[](void *p_user, bool p_enable, const Array &p_opts) {
Expand Down
2 changes: 1 addition & 1 deletion core/debugger/remote_debugger_peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create(const String &p_uri) {
debug_host = debug_host.substr(0, sep_pos);
}

RemoteDebuggerPeerTCP *peer = memnewOldNoConstructor(RemoteDebuggerPeerTCP);
RemoteDebuggerPeerTCP *peer = memnewNoConstructor<RemoteDebuggerPeerTCP>();
Error err = peer->connect_to_host(debug_host, debug_port);
if (err != OK) {
memdelete(peer);
Expand Down
14 changes: 7 additions & 7 deletions core/extension/gdextension_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ static void gdextension_ref_set_object(GDExtensionRefPtr p_ref, GDExtensionObjec

#ifndef DISABLE_DEPRECATED
static GDExtensionScriptInstancePtr gdextension_script_instance_create(const GDExtensionScriptInstanceInfo *p_info, GDExtensionScriptInstanceDataPtr p_instance_data) {
GDExtensionScriptInstanceInfo3 *info_3 = memnewOldNoConstructor(GDExtensionScriptInstanceInfo3);
GDExtensionScriptInstanceInfo3 *info_3 = memnewNoConstructor<GDExtensionScriptInstanceInfo3>();
info_3->set_func = p_info->set_func;
info_3->get_func = p_info->get_func;
info_3->get_property_list_func = p_info->get_property_list_func;
Expand Down Expand Up @@ -1357,19 +1357,19 @@ static GDExtensionScriptInstancePtr gdextension_script_instance_create(const GDE
info_3->get_language_func = p_info->get_language_func;
info_3->free_func = p_info->free_func;

ScriptInstanceExtension *script_instance_extension = memnewOldNoConstructor(ScriptInstanceExtension);
ScriptInstanceExtension *script_instance_extension = memnewNoConstructor<ScriptInstanceExtension>();
script_instance_extension->instance = p_instance_data;
script_instance_extension->native_info = info_3;
script_instance_extension->free_native_info = true;
script_instance_extension->deprecated_native_info = memnewOldNoConstructor(ScriptInstanceExtension::DeprecatedNativeInfo);
script_instance_extension->deprecated_native_info = memnewNoConstructor<ScriptInstanceExtension::DeprecatedNativeInfo>();
script_instance_extension->deprecated_native_info->notification_func = p_info->notification_func;
script_instance_extension->deprecated_native_info->free_property_list_func = p_info->free_property_list_func;
script_instance_extension->deprecated_native_info->free_method_list_func = p_info->free_method_list_func;
return reinterpret_cast<GDExtensionScriptInstancePtr>(script_instance_extension);
}

static GDExtensionScriptInstancePtr gdextension_script_instance_create2(const GDExtensionScriptInstanceInfo2 *p_info, GDExtensionScriptInstanceDataPtr p_instance_data) {
GDExtensionScriptInstanceInfo3 *info_3 = memnewOldNoConstructor(GDExtensionScriptInstanceInfo3);
GDExtensionScriptInstanceInfo3 *info_3 = memnewNoConstructor<GDExtensionScriptInstanceInfo3>();
info_3->set_func = p_info->set_func;
info_3->get_func = p_info->get_func;
info_3->get_property_list_func = p_info->get_property_list_func;
Expand Down Expand Up @@ -1397,19 +1397,19 @@ static GDExtensionScriptInstancePtr gdextension_script_instance_create2(const GD
info_3->get_language_func = p_info->get_language_func;
info_3->free_func = p_info->free_func;

ScriptInstanceExtension *script_instance_extension = memnewOldNoConstructor(ScriptInstanceExtension);
ScriptInstanceExtension *script_instance_extension = memnewNoConstructor<ScriptInstanceExtension>();
script_instance_extension->instance = p_instance_data;
script_instance_extension->native_info = info_3;
script_instance_extension->free_native_info = true;
script_instance_extension->deprecated_native_info = memnewOldNoConstructor(ScriptInstanceExtension::DeprecatedNativeInfo);
script_instance_extension->deprecated_native_info = memnewNoConstructor<ScriptInstanceExtension::DeprecatedNativeInfo>();
script_instance_extension->deprecated_native_info->free_property_list_func = p_info->free_property_list_func;
script_instance_extension->deprecated_native_info->free_method_list_func = p_info->free_method_list_func;
return reinterpret_cast<GDExtensionScriptInstancePtr>(script_instance_extension);
}
#endif // DISABLE_DEPRECATED

static GDExtensionScriptInstancePtr gdextension_script_instance_create3(const GDExtensionScriptInstanceInfo3 *p_info, GDExtensionScriptInstanceDataPtr p_instance_data) {
ScriptInstanceExtension *script_instance_extension = memnewOldNoConstructor(ScriptInstanceExtension);
ScriptInstanceExtension *script_instance_extension = memnewNoConstructor<ScriptInstanceExtension>();
script_instance_extension->instance = p_instance_data;
script_instance_extension->native_info = p_info;
return reinterpret_cast<GDExtensionScriptInstancePtr>(script_instance_extension);
Expand Down
2 changes: 1 addition & 1 deletion core/io/file_access_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void FileAccessMemory::cleanup() {
}

Ref<FileAccess> FileAccessMemory::create() {
return memnewOldNoConstructor(FileAccessMemory);
return memnewNoConstructor<FileAccessMemory>();
}

bool FileAccessMemory::file_exists(const String &p_name) {
Expand Down
6 changes: 3 additions & 3 deletions core/io/file_access_pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void PackedData::add_path(const String &p_pkg_path, const String &p_path, uint64

for (int j = 0; j < ds.size(); j++) {
if (!cd->subdirs.has(ds[j])) {
PackedDir *pd = memnewOldNoConstructor(PackedDir);
PackedDir *pd = memnewNoConstructor<PackedDir>();
pd->name = ds[j];
pd->parent = cd;
cd->subdirs[pd->name] = pd;
Expand Down Expand Up @@ -106,9 +106,9 @@ PackedData *PackedData::singleton = nullptr;

PackedData::PackedData() {
singleton = this;
root = memnewOldNoConstructor(PackedDir);
root = memnewNoConstructor<PackedDir>();

add_pack_source(memnewOldNoConstructor(PackedSourcePCK));
add_pack_source(memnewNoConstructor<PackedSourcePCK>());
}

void PackedData::_free_packed_dirs(PackedDir *p_dir) {
Expand Down
4 changes: 2 additions & 2 deletions core/io/file_access_zip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static void *godot_open(voidpf opaque, const char *p_fname, int mode) {
Ref<FileAccess> f = FileAccess::open(String::utf8(p_fname), FileAccess::READ);
ERR_FAIL_COND_V(f.is_null(), nullptr);

ZipData *zd = memnewOldNoConstructor(ZipData);
ZipData *zd = memnewNoConstructor<ZipData>();
zd->f = f;
return zd;
}
Expand Down Expand Up @@ -216,7 +216,7 @@ Ref<FileAccess> ZipArchive::get_file(const String &p_path, PackedData::PackedFil

ZipArchive *ZipArchive::get_singleton() {
if (instance == nullptr) {
instance = memnewOldNoConstructor(ZipArchive);
instance = memnewNoConstructor<ZipArchive>();
}

return instance;
Expand Down
2 changes: 1 addition & 1 deletion core/io/http_client_tcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "core/version.h"

HTTPClient *HTTPClientTCP::_create_func() {
return memnewOldNoConstructor(HTTPClientTCP);
return memnewNoConstructor<HTTPClientTCP>();
}

Error HTTPClientTCP::connect_to_host(const String &p_host, int p_port, Ref<TLSOptions> p_options) {
Expand Down
2 changes: 1 addition & 1 deletion core/io/ip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ IP *IP::create() {

IP::IP() {
singleton = this;
resolver = memnewOldNoConstructor(_IP_ResolverPrivate);
resolver = memnewNoConstructor<_IP_ResolverPrivate>();

resolver->thread_abort.clear();
resolver->thread.start(_IP_ResolverPrivate::_thread_function, resolver);
Expand Down
2 changes: 1 addition & 1 deletion core/io/packed_data_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Variant PackedDataContainer::_get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, b
uint32_t type = decode_uint32(p_buf + p_ofs);

if (type == TYPE_ARRAY || type == TYPE_DICT) {
Ref<PackedDataContainerRef> pdcr = memnewOldNoConstructor(PackedDataContainerRef);
Ref<PackedDataContainerRef> pdcr = memnewNoConstructor<PackedDataContainerRef>();
Ref<PackedDataContainer> pdc = Ref<PackedDataContainer>(const_cast<PackedDataContainer *>(this));

pdcr->from = pdc;
Expand Down
2 changes: 1 addition & 1 deletion core/io/resource_format_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ Error ResourceLoaderBinary::load() {
if (!obj) {
if (ResourceLoader::is_creating_missing_resources_if_class_unavailable_enabled()) {
//create a missing resource
missing_resource = memnewOldNoConstructor(MissingResource);
missing_resource = memnewNoConstructor<MissingResource>();
missing_resource->set_original_class(t);
missing_resource->set_recording_properties(true);
obj = missing_resource;
Expand Down
4 changes: 2 additions & 2 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void ResourceLoader::_run_load_task(void *p_userdata) {
if (!Thread::is_main_thread()) {
// Let the caller thread use its own, for added flexibility. Provide one otherwise.
if (MessageQueue::get_singleton() == MessageQueue::get_main_singleton()) {
own_mq_override = memnewOldNoConstructor(CallQueue);
own_mq_override = memnewNoConstructor<CallQueue>();
MessageQueue::set_thread_singleton_override(own_mq_override);
}
set_current_thread_safe_for_nodes(true);
Expand Down Expand Up @@ -810,7 +810,7 @@ Ref<Resource> ResourceLoader::_load_complete_inner(LoadToken &p_load_token, Erro
} else if (load_task.need_wait) {
// Loading thread is main or user thread.
if (!load_task.cond_var) {
load_task.cond_var = memnewOldNoConstructor(ConditionVariable);
load_task.cond_var = memnewNoConstructor<ConditionVariable>();
}
load_task.awaiters_count++;
do {
Expand Down
2 changes: 1 addition & 1 deletion core/io/resource_uid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ ResourceUID *ResourceUID::singleton = nullptr;
ResourceUID::ResourceUID() {
ERR_FAIL_COND(singleton != nullptr);
singleton = this;
crypto = memnewOldNoConstructor(CryptoCore::RandomGenerator);
crypto = memnewNoConstructor<CryptoCore::RandomGenerator>();
((CryptoCore::RandomGenerator *)crypto)->init();
}
ResourceUID::~ResourceUID() {
Expand Down
2 changes: 1 addition & 1 deletion core/io/tcp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Ref<StreamPeerTCP> TCPServer::take_connection() {
return conn;
}

conn = Ref<StreamPeerTCP>(memnewOldNoConstructor(StreamPeerTCP));
conn = Ref<StreamPeerTCP>(memnewNoConstructor<StreamPeerTCP>());
conn->accept_socket(ns, ip, port);
return conn;
}
Expand Down
2 changes: 1 addition & 1 deletion core/io/translation_loader_po.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_
}

const String path = f->get_path();
Ref<TranslationPO> translation = Ref<TranslationPO>(memnewOldNoConstructor(TranslationPO));
Ref<TranslationPO> translation = Ref<TranslationPO>(memnewNoConstructor<TranslationPO>());
String config;

uint32_t magic = f->get_32();
Expand Down
2 changes: 1 addition & 1 deletion core/io/udp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Error UDPServer::poll() {
Peer peer;
peer.ip = ip;
peer.port = port;
peer.peer = memnewOldNoConstructor(PacketPeerUDP);
peer.peer = memnewNoConstructor<PacketPeerUDP>();
peer.peer->connect_shared_socket(_sock, ip, port, this);
peer.peer->store_packet(ip, port, recv_buffer, read);
pending.push_back(peer);
Expand Down
2 changes: 1 addition & 1 deletion core/math/a_star.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void AStar3D::add_point(int64_t p_id, const Vector3 &p_pos, real_t p_weight_scal
bool p_exists = points.lookup(p_id, found_pt);

if (!p_exists) {
Point *pt = memnewOldNoConstructor(Point);
Point *pt = memnewNoConstructor<Point>();
pt->id = p_id;
pt->pos = p_pos;
pt->weight_scale = p_weight_scale;
Expand Down
2 changes: 1 addition & 1 deletion core/math/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class Expression : public RefCounted {

template <typename T>
T *alloc_node() {
T *node = memnewOldNoConstructor(T);
T *node = memnewNoConstructor<T>();
node->next = nodes;
nodes = node;
return node;
Expand Down
2 changes: 1 addition & 1 deletion core/object/make_virtuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def run(target, source, env):
#ifdef TOOLS_ENABLED
#define GDVIRTUAL_TRACK(m_virtual, m_initialized)\\
if (_get_extension()->reloadable) {\\
VirtualMethodTracker *tracker = memnewOldNoConstructor(VirtualMethodTracker);\\
VirtualMethodTracker *tracker = memnewNoConstructor<VirtualMethodTracker>();\\
tracker->method = (void **)&m_virtual;\\
tracker->initialized = &m_initialized;\\
tracker->next = virtual_method_list;\\
Expand Down
4 changes: 2 additions & 2 deletions core/object/worker_thread_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class WorkerThreadPool : public Object {
template <typename C, typename M, typename U>
TaskID add_template_task(C *p_instance, M p_method, U p_userdata, bool p_high_priority = false, const String &p_description = String()) {
typedef TaskUserData<C, M, U> TUD;
TUD *ud = memnewOldNoConstructor(TUD);
TUD *ud = memnewNoConstructor<TUD>();
ud->instance = p_instance;
ud->method = p_method;
ud->userdata = p_userdata;
Expand All @@ -227,7 +227,7 @@ class WorkerThreadPool : public Object {
template <typename C, typename M, typename U>
GroupID add_template_group_task(C *p_instance, M p_method, U p_userdata, int p_elements, int p_tasks = -1, bool p_high_priority = false, const String &p_description = String()) {
typedef GroupUserData<C, M, U> GroupUD;
GroupUD *ud = memnewOldNoConstructor(GroupUD);
GroupUD *ud = memnewNoConstructor<GroupUD>();
ud->instance = p_instance;
ud->method = p_method;
ud->userdata = p_userdata;
Expand Down
2 changes: 1 addition & 1 deletion core/os/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ OS::OS() {
singleton = this;

Vector<Logger *> loggers;
loggers.push_back(memnewOldNoConstructor(StdLogger));
loggers.push_back(memnewNoConstructor<StdLogger>());
_set_logger(memnewWithArgs<CompositeLogger>(loggers));
}

Expand Down
26 changes: 13 additions & 13 deletions core/register_core_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void register_core_types() {
ObjectDB::setup();

StringName::setup();
_time = memnewOldNoConstructor(Time);
_time = memnewNoConstructor<Time>();
ResourceLoader::initialize();

register_global_constants();
Expand Down Expand Up @@ -272,31 +272,31 @@ void register_core_types() {

GDREGISTER_CLASS(EngineProfiler);

resource_uid = memnewOldNoConstructor(ResourceUID);
resource_uid = memnewNoConstructor<ResourceUID>();

gdextension_manager = memnewOldNoConstructor(GDExtensionManager);
gdextension_manager = memnewNoConstructor<GDExtensionManager>();

resource_loader_gdextension.instantiate();
ResourceLoader::add_resource_format_loader(resource_loader_gdextension);

ip = IP::create();

_geometry_2d = memnewOldNoConstructor(core_bind::Geometry2D);
_geometry_3d = memnewOldNoConstructor(core_bind::Geometry3D);
_geometry_2d = memnewNoConstructor<core_bind::Geometry2D>();
_geometry_3d = memnewNoConstructor<core_bind::Geometry3D>();

_resource_loader = memnewOldNoConstructor(core_bind::ResourceLoader);
_resource_saver = memnewOldNoConstructor(core_bind::ResourceSaver);
_os = memnewOldNoConstructor(core_bind::OS);
_engine = memnewOldNoConstructor(core_bind::Engine);
_classdb = memnewOldNoConstructor(core_bind::special::ClassDB);
_marshalls = memnewOldNoConstructor(core_bind::Marshalls);
_engine_debugger = memnewOldNoConstructor(core_bind::EngineDebugger);
_resource_loader = memnewNoConstructor<core_bind::ResourceLoader>();
_resource_saver = memnewNoConstructor<core_bind::ResourceSaver>();
_os = memnewNoConstructor<core_bind::OS>();
_engine = memnewNoConstructor<core_bind::Engine>();
_classdb = memnewNoConstructor<core_bind::special::ClassDB>();
_marshalls = memnewNoConstructor<core_bind::Marshalls>();
_engine_debugger = memnewNoConstructor<core_bind::EngineDebugger>();

GDREGISTER_NATIVE_STRUCT(ObjectID, "uint64_t id = 0");
GDREGISTER_NATIVE_STRUCT(AudioFrame, "float left;float right");
GDREGISTER_NATIVE_STRUCT(ScriptLanguageExtensionProfilingInfo, "StringName signature;uint64_t call_count;uint64_t total_time;uint64_t self_time");

worker_thread_pool = memnewOldNoConstructor(WorkerThreadPool);
worker_thread_pool = memnewNoConstructor<WorkerThreadPool>();

OS::get_singleton()->benchmark_end_measure("Core", "Register Types");
}
Expand Down
6 changes: 3 additions & 3 deletions core/string/node_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ NodePath::NodePath(const Vector<StringName> &p_path, bool p_absolute) {
return;
}

data = memnewOldNoConstructor(Data);
data = memnewNoConstructor<Data>();
data->refcount.init();
data->absolute = p_absolute;
data->path = p_path;
Expand All @@ -376,7 +376,7 @@ NodePath::NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p
return;
}

data = memnewOldNoConstructor(Data);
data = memnewNoConstructor<Data>();
data->refcount.init();
data->absolute = p_absolute;
data->path = p_path;
Expand Down Expand Up @@ -441,7 +441,7 @@ NodePath::NodePath(const String &p_path) {
return;
}

data = memnewOldNoConstructor(Data);
data = memnewNoConstructor<Data>();
data->refcount.init();
data->absolute = absolute;
data->subpath = subpath;
Expand Down
Loading

0 comments on commit 308b41d

Please sign in to comment.