Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: webrtc/base/flags.cc

Issue 2718663005: Replace NULL with nullptr or null in webrtc/base/. (Closed)
Patch Set: Fixing Windows and formatting issues. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/flags.h ('k') | webrtc/base/httpbase.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/flags.cc
diff --git a/webrtc/base/flags.cc b/webrtc/base/flags.cc
index 4fcd4acc11bf8f68d53c16150ee82e8426240ec4..9b7177c22c15dd28f75c8b2076349fcb76c3983e 100644
--- a/webrtc/base/flags.cc
+++ b/webrtc/base/flags.cc
@@ -106,19 +106,18 @@ void Flag::Print(bool print_current_value) {
// -----------------------------------------------------------------------------
// Implementation of FlagList
-Flag* FlagList::list_ = NULL;
-
+Flag* FlagList::list_ = nullptr;
FlagList::FlagList() {
- list_ = NULL;
+ list_ = nullptr;
}
void FlagList::Print(const char* file, bool print_current_value) {
// Since flag registration is likely by file (= C++ file),
// we don't need to sort by file and still get grouped output.
- const char* current = NULL;
- for (Flag* f = list_; f != NULL; f = f->next()) {
- if (file == NULL || file == f->file()) {
+ const char* current = nullptr;
+ for (Flag* f = list_; f != nullptr; f = f->next()) {
+ if (file == nullptr || file == f->file()) {
if (current != f->file()) {
printf("Flags from %s:\n", f->file());
current = f->file();
@@ -131,7 +130,7 @@ void FlagList::Print(const char* file, bool print_current_value) {
Flag* FlagList::Lookup(const char* name) {
Flag* f = list_;
- while (f != NULL && strcmp(name, f->name()) != 0)
+ while (f != nullptr && strcmp(name, f->name()) != 0)
f = f->next();
return f;
}
@@ -141,8 +140,8 @@ void FlagList::SplitArgument(const char* arg,
char* buffer, int buffer_size,
const char** name, const char** value,
bool* is_bool) {
- *name = NULL;
- *value = NULL;
+ *name = nullptr;
+ *value = nullptr;
*is_bool = false;
if (*arg == '-') {
@@ -189,16 +188,16 @@ int FlagList::SetFlagsFromCommandLine(int* argc, const char** argv,
bool is_bool;
SplitArgument(arg, buffer, sizeof buffer, &name, &value, &is_bool);
- if (name != NULL) {
+ if (name != nullptr) {
// lookup the flag
Flag* flag = Lookup(name);
- if (flag == NULL) {
+ if (flag == nullptr) {
fprintf(stderr, "Error: unrecognized flag %s\n", arg);
return j;
}
// if we still need a flag value, use the next argument if available
- if (flag->type() != Flag::BOOL && value == NULL) {
+ if (flag->type() != Flag::BOOL && value == nullptr) {
if (i < *argc) {
value = argv[i++];
} else {
@@ -227,9 +226,8 @@ int FlagList::SetFlagsFromCommandLine(int* argc, const char** argv,
}
// handle errors
- if ((flag->type() == Flag::BOOL && value != NULL) ||
- (flag->type() != Flag::BOOL && is_bool) ||
- *endp != '\0') {
+ if ((flag->type() == Flag::BOOL && value != nullptr) ||
+ (flag->type() != Flag::BOOL && is_bool) || *endp != '\0') {
fprintf(stderr, "Error: illegal value for flag %s of type %s\n",
arg, Type2String(flag->type()));
return j;
@@ -238,7 +236,7 @@ int FlagList::SetFlagsFromCommandLine(int* argc, const char** argv,
// remove the flag & value from the command
if (remove_flags)
while (j < i)
- argv[j++] = NULL;
+ argv[j++] = nullptr;
}
}
@@ -246,7 +244,7 @@ int FlagList::SetFlagsFromCommandLine(int* argc, const char** argv,
if (remove_flags) {
int j = 1;
for (int i = 1; i < *argc; i++) {
- if (argv[i] != NULL)
+ if (argv[i] != nullptr)
argv[j++] = argv[i];
}
*argc = j;
« no previous file with comments | « webrtc/base/flags.h ('k') | webrtc/base/httpbase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698