Skip to content

Commit d085e00

Browse files
authored
Merge pull request #5440 from ab9rf/remove-registerdata
Remove unused `RegisterData` API from Core
2 parents 0f7281f + 94cdaf7 commit d085e00

File tree

3 files changed

+1
-31
lines changed

3 files changed

+1
-31
lines changed

docs/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Template for new versions:
7777
- ``script-manager``: new ``get_mod_info_metadata()`` function for getting information out of mod ``info.txt`` files
7878

7979
## Removed
80+
- removed historically unused ``Core::RegisterData``/``Core::GetData`` API and associated internal data structures
8081

8182
# 51.11-r1.2
8283

library/Core.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,6 @@ Core::Core() :
14961496
HotkeyCond{},
14971497
alias_mutex{},
14981498
started{false},
1499-
misc_data_mutex{},
15001499
CoreSuspendMutex{},
15011500
CoreWakeup{},
15021501
ownerThread{},
@@ -1995,28 +1994,6 @@ void Core::printerr(const char *format, ...)
19951994
va_end(args);
19961995
}
19971996

1998-
void Core::RegisterData( void *p, std::string key )
1999-
{
2000-
std::lock_guard<std::mutex> lock(misc_data_mutex);
2001-
misc_data_map[key] = p;
2002-
}
2003-
2004-
void *Core::GetData( std::string key )
2005-
{
2006-
std::lock_guard<std::mutex> lock(misc_data_mutex);
2007-
std::map<std::string,void*>::iterator it=misc_data_map.find(key);
2008-
2009-
if ( it != misc_data_map.end() )
2010-
{
2011-
void *p=it->second;
2012-
return p;
2013-
}
2014-
else
2015-
{
2016-
return 0;// or throw an error.
2017-
}
2018-
}
2019-
20201997
Core& Core::getInstance() {
20211998
static Core instance;
20221999
return instance;

library/include/Core.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,6 @@ namespace DFHack
168168
/// removes the hotkey command and gives it to the caller thread
169169
std::string getHotkeyCmd( bool &keep_going );
170170

171-
/// adds a named pointer (for later or between plugins)
172-
void RegisterData(void *p,std::string key);
173-
/// returns a named pointer.
174-
void *GetData(std::string key);
175-
176171
command_result runCommand(color_ostream &out, const std::string &command, std::vector <std::string> &parameters, bool no_autocomplete = false);
177172
command_result runCommand(color_ostream &out, const std::string &command);
178173
bool loadScriptFile(color_ostream &out, std::filesystem::path fname, bool silent = false);
@@ -316,9 +311,6 @@ namespace DFHack
316311
// Additional state change scripts
317312
std::vector<StateChangeScript> state_change_scripts;
318313

319-
std::mutex misc_data_mutex;
320-
std::map<std::string,void*> misc_data_map;
321-
322314
/*!
323315
* \defgroup core_suspend CoreSuspender state handling serialization to
324316
* DF memory.

0 commit comments

Comments
 (0)