Skip to content

Commit cb8978f

Browse files
committedJul 9, 2015
Settings: pass name to callbacks by reference
Spare some copies.
1 parent 4ece2b9 commit cb8978f

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed
 

Diff for: ‎src/clouds.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Clouds;
3030
Clouds *g_menuclouds = NULL;
3131
irr::scene::ISceneManager *g_menucloudsmgr = NULL;
3232

33-
static void cloud_3d_setting_changed(const std::string settingname, void *data)
33+
static void cloud_3d_setting_changed(const std::string &settingname, void *data)
3434
{
3535
((Clouds *)data)->readSettings();
3636
}

Diff for: ‎src/fontengine.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
3535
FontEngine* g_fontengine = NULL;
3636

3737
/** callback to be used on change of font size setting */
38-
static void font_setting_changed(const std::string, void *userdata) {
38+
static void font_setting_changed(const std::string &name, void *userdata)
39+
{
3940
g_fontengine->readSettings();
4041
}
4142

Diff for: ‎src/game.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
806806
m_fogEnabled = g_settings->getBool("enable_fog");
807807
}
808808

809-
static void SettingsCallback(const std::string name, void *userdata)
809+
static void SettingsCallback(const std::string &name, void *userdata)
810810
{
811811
reinterpret_cast<GameGlobalShaderConstantSetter*>(userdata)->onSettingsChange(name);
812812
}

Diff for: ‎src/settings.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extern Settings *g_settings;
3636
extern std::string g_settings_path;
3737

3838
/** function type to register a changed callback */
39-
typedef void (*setting_changed_callback)(const std::string, void*);
39+
typedef void (*setting_changed_callback)(const std::string &name, void *data);
4040

4141
enum ValueType {
4242
VALUETYPE_STRING,

0 commit comments

Comments
 (0)
Please sign in to comment.