@@ -190,7 +190,7 @@ void SignalHandler::Install(const string& product_name,
190
190
// Unblock all signals.
191
191
sigset_t sigset ;
192
192
sigemptyset (&sigset );
193
- sigprocmask (SIG_SETMASK, &sigset , NULL );
193
+ sigprocmask (SIG_SETMASK, &sigset , nullptr );
194
194
195
195
signal (SIGINT, handler);
196
196
signal (SIGTERM, handler);
@@ -255,7 +255,7 @@ class CharPP {
255
255
for (; i < args.size (); i++) {
256
256
charpp_[i] = strdup (args[i].c_str ());
257
257
}
258
- charpp_[i] = NULL ;
258
+ charpp_[i] = nullptr ;
259
259
}
260
260
261
261
// Constructs a new CharPP from a list of environment variables.
@@ -279,12 +279,12 @@ class CharPP {
279
279
assert (false );
280
280
}
281
281
}
282
- charpp_[i] = NULL ;
282
+ charpp_[i] = nullptr ;
283
283
}
284
284
285
285
// Deletes all memory held by the CharPP.
286
286
~CharPP () {
287
- for (char ** ptr = charpp_; *ptr != NULL ; ptr++) {
287
+ for (char ** ptr = charpp_; *ptr != nullptr ; ptr++) {
288
288
free (*ptr);
289
289
}
290
290
free (charpp_);
@@ -532,14 +532,12 @@ void CreateSecureOutputRoot(const blaze_util::Path& path) {
532
532
533
533
string GetEnv (const string& name) {
534
534
char * result = getenv (name.c_str ());
535
- return result != NULL ? string (result) : " " ;
535
+ return result != nullptr ? string (result) : " " ;
536
536
}
537
537
538
538
string GetPathEnv (const string& name) { return GetEnv (name); }
539
539
540
- bool ExistsEnv (const string& name) {
541
- return getenv (name.c_str ()) != NULL ;
542
- }
540
+ bool ExistsEnv (const string& name) { return getenv (name.c_str ()) != nullptr ; }
543
541
544
542
void SetEnv (const string& name, const string& value) {
545
543
setenv (name.c_str (), value.c_str (), 1 );
@@ -558,8 +556,8 @@ void SetupStdStreams() {
558
556
// output (when for example a query returns results as proto), in which case
559
557
// we must not perform line buffering on the client side. So turn off
560
558
// buffering here completely.
561
- setvbuf (stdout, NULL , _IONBF, 0 );
562
- setvbuf (stderr, NULL , _IONBF, 0 );
559
+ setvbuf (stdout, nullptr , _IONBF, 0 );
560
+ setvbuf (stderr, nullptr , _IONBF, 0 );
563
561
564
562
// Ensure we have three open fds. Otherwise we can end up with
565
563
// bizarre things like stdout going to the lock file, etc.
@@ -736,7 +734,7 @@ void TrySleep(unsigned int milliseconds) {
736
734
time_t seconds_part = (time_t )(milliseconds / 1000 );
737
735
long nanoseconds_part = ((long )(milliseconds % 1000 )) * 1000 * 1000 ;
738
736
struct timespec sleeptime = {seconds_part, nanoseconds_part};
739
- nanosleep (&sleeptime, NULL );
737
+ nanosleep (&sleeptime, nullptr );
740
738
}
741
739
742
740
string GetUserName () {
@@ -746,7 +744,7 @@ string GetUserName() {
746
744
}
747
745
errno = 0 ;
748
746
passwd *pwent = getpwuid (getuid ()); // NOLINT (single-threaded)
749
- if (pwent == NULL || pwent->pw_name == NULL ) {
747
+ if (pwent == nullptr || pwent->pw_name == nullptr ) {
750
748
BAZEL_DIE (blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)
751
749
<< " $USER is not set, and unable to look up name of current user: "
752
750
<< GetLastErrorString ();
0 commit comments