Skip to content

Commit 15c24a0

Browse files
Googlera-maurice
authored andcommitted
Make firebase::kDefaultAppName const.
The Google C++ Style guide says that names starting with a leading "k" should be for constants, i.e. for variables declared "constexpr" or "const" and whose value is fixed for the duration of the program. But before this change, kDefaultAppName was not declared "const", and could be modified. This change is not strictly backwards compatible; any programs which did attempt to modify kDefaultAppName would break. However, kDefaultAppName is not documented in the API documentation, so I think this is OK. Also a Google search for "kDefaultAppName" and "firebase" didn't get any hits other than the Firebase API docs and the Firebase source code, so don't think there is any open-source code which is doing this. PiperOrigin-RevId: 256182269
1 parent 3972979 commit 15c24a0

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

app/src/app_android.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ METHOD_LOOKUP_DEFINITION(
137137
"com/google/firebase/platforminfo/GlobalLibraryVersionRegistrar",
138138
GLOBAL_LIBRARY_VERSION_REGISTAR_METHODS)
139139

140-
const char* kDefaultAppName = "__FIRAPP_DEFAULT";
140+
const char* const kDefaultAppName = "__FIRAPP_DEFAULT";
141141

142142
namespace {
143143

app/src/app_desktop.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static std::string g_default_config_path; // NOLINT
4545
} // namespace internal
4646

4747
// The default App name, the same string as what are used for Android and iOS.
48-
const char* kDefaultAppName = "__FIRAPP_DEFAULT";
48+
const char* const kDefaultAppName = "__FIRAPP_DEFAULT";
4949

5050
App::App() {
5151
LogDebug("Creating firebase::App for %s", kFirebaseVersionString);

app/src/app_ios.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ - (void)setDataCollectionDefaultEnabled:(BOOL)dataCollectionDefaultEnabled;
5151

5252
DEFINE_FIREBASE_VERSION_STRING(Firebase);
5353

54-
const char* kDefaultAppName = "__FIRAPP_DEFAULT";
54+
const char* const kDefaultAppName = "__FIRAPP_DEFAULT";
5555

5656
App::App() : data_(nullptr) {
5757
LogDebug("Creating firebase::App for %s", kFirebaseVersionString);

app/src/app_stub.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace firebase {
2929

3030
DEFINE_FIREBASE_VERSION_STRING(Firebase);
3131

32-
const char* kDefaultAppName = "default";
32+
const char* const kDefaultAppName = "default";
3333

3434
App::App() : data_(new internal::FunctionRegistry) {
3535
LogDebug("Creating firebase::App for %s", kFirebaseVersionString);

app/src/include/firebase/app.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ enum InitResult {
102102
};
103103

104104
/// @brief Default name for firebase::App() objects.
105-
extern const char* kDefaultAppName;
105+
extern const char* const kDefaultAppName;
106106

107107
/// @brief Options that control the creation of a Firebase App.
108108
/// @if cpp_examples

0 commit comments

Comments
 (0)