@@ -190,7 +190,7 @@ void SignalHandler::Install(const string& product_name,
190190 // Unblock all signals.
191191 sigset_t sigset;
192192 sigemptyset (&sigset);
193- sigprocmask (SIG_SETMASK, &sigset, NULL );
193+ sigprocmask (SIG_SETMASK, &sigset, nullptr );
194194
195195 signal (SIGINT, handler);
196196 signal (SIGTERM, handler);
@@ -255,7 +255,7 @@ class CharPP {
255255 for (; i < args.size (); i++) {
256256 charpp_[i] = strdup (args[i].c_str ());
257257 }
258- charpp_[i] = NULL ;
258+ charpp_[i] = nullptr ;
259259 }
260260
261261 // Constructs a new CharPP from a list of environment variables.
@@ -279,12 +279,12 @@ class CharPP {
279279 assert (false );
280280 }
281281 }
282- charpp_[i] = NULL ;
282+ charpp_[i] = nullptr ;
283283 }
284284
285285 // Deletes all memory held by the CharPP.
286286 ~CharPP () {
287- for (char ** ptr = charpp_; *ptr != NULL ; ptr++) {
287+ for (char ** ptr = charpp_; *ptr != nullptr ; ptr++) {
288288 free (*ptr);
289289 }
290290 free (charpp_);
@@ -532,14 +532,12 @@ void CreateSecureOutputRoot(const blaze_util::Path& path) {
532532
533533string GetEnv (const string& name) {
534534 char * result = getenv (name.c_str ());
535- return result != NULL ? string (result) : " " ;
535+ return result != nullptr ? string (result) : " " ;
536536}
537537
538538string GetPathEnv (const string& name) { return GetEnv (name); }
539539
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 ; }
543541
544542void SetEnv (const string& name, const string& value) {
545543 setenv (name.c_str (), value.c_str (), 1 );
@@ -558,8 +556,8 @@ void SetupStdStreams() {
558556 // output (when for example a query returns results as proto), in which case
559557 // we must not perform line buffering on the client side. So turn off
560558 // 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 );
563561
564562 // Ensure we have three open fds. Otherwise we can end up with
565563 // bizarre things like stdout going to the lock file, etc.
@@ -736,7 +734,7 @@ void TrySleep(unsigned int milliseconds) {
736734 time_t seconds_part = (time_t )(milliseconds / 1000 );
737735 long nanoseconds_part = ((long )(milliseconds % 1000 )) * 1000 * 1000 ;
738736 struct timespec sleeptime = {seconds_part, nanoseconds_part};
739- nanosleep (&sleeptime, NULL );
737+ nanosleep (&sleeptime, nullptr );
740738}
741739
742740string GetUserName () {
@@ -746,7 +744,7 @@ string GetUserName() {
746744 }
747745 errno = 0 ;
748746 passwd *pwent = getpwuid (getuid ()); // NOLINT (single-threaded)
749- if (pwent == NULL || pwent->pw_name == NULL ) {
747+ if (pwent == nullptr || pwent->pw_name == nullptr ) {
750748 BAZEL_DIE (blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)
751749 << " $USER is not set, and unable to look up name of current user: "
752750 << GetLastErrorString ();
0 commit comments