Skip to content

Commit 2900a4e

Browse files
committed
Consistently use C++ nullptr instead of NULL
Those should be equivalent, just have different type.
1 parent 96f0a62 commit 2900a4e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

judge/runguard.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ void output_cgroup_stats_v2(double *cputime)
539539
while (ret == 0) {
540540
verbose("cpu.stat: %s = %s", stat.name, stat.value);
541541
if (strcmp(stat.name, "usage_usec") == 0) {
542-
long long usec = strtoll(stat.value, NULL, 10);
542+
long long usec = strtoll(stat.value, nullptr, 10);
543543
*cputime = usec / 1e6;
544544
}
545545
ret = cgroup_read_stats_next(&handle, &stat);
@@ -899,7 +899,7 @@ void setrestrictions()
899899

900900
/* Put the child process in the cgroup */
901901
if (is_cgroup_v2) {
902-
const char *controllers[] = { "memory", NULL };
902+
const char *controllers[] = { "memory", nullptr };
903903
if (cgroup_change_cgroup_path(cgroupname, getpid(), controllers) != 0) {
904904
error(0, "Failed to move the process to the cgroup");
905905
}
@@ -948,7 +948,7 @@ void setrestrictions()
948948
/* Set group-id (must be root for this, so before setting user). */
949949
if ( use_group ) {
950950
if ( setgid(rungid) ) error(errno,"cannot set group ID to `%d'",rungid);
951-
if ( setgroups(0, NULL) ) error(errno,"cannot clear auxiliary groups");
951+
if ( setgroups(0, nullptr) ) error(errno,"cannot clear auxiliary groups");
952952

953953
verbose("using group ID `%d'",rungid);
954954
}
@@ -1114,7 +1114,7 @@ int main(int argc, char **argv)
11141114
case 'u': /* user option: uid or string */
11151115
use_user = 1;
11161116
runuser = strdup(optarg);
1117-
if ( runuser==NULL ) error(errno,"strdup() failed");
1117+
if ( runuser==nullptr ) error(errno,"strdup() failed");
11181118
errno = 0;
11191119
runuid = strtol(optarg,&ptr,10);
11201120
if ( errno || *ptr!='\0' ) {
@@ -1131,7 +1131,7 @@ int main(int argc, char **argv)
11311131
case 'g': /* group option: gid or string */
11321132
use_group = 1;
11331133
rungroup = strdup(optarg);
1134-
if ( rungroup==NULL ) error(errno,"strdup() failed");
1134+
if ( rungroup==nullptr ) error(errno,"strdup() failed");
11351135
errno = 0;
11361136
rungid = strtol(optarg,&ptr,10);
11371137
if ( errno || *ptr!='\0' ) rungid = groupid(optarg);
@@ -1486,7 +1486,7 @@ int main(int argc, char **argv)
14861486
}
14871487
}
14881488

1489-
int r = pselect(nfds+1, &readfds, nullptr, NULL, NULL, &emptymask);
1489+
int r = pselect(nfds+1, &readfds, nullptr, nullptr, nullptr, &emptymask);
14901490
if ( r==-1 && errno!=EINTR ) error(errno,"waiting for child data");
14911491
if (error_in_signalhandler) {
14921492
error(errno, "error in signal handler, exiting");

0 commit comments

Comments
 (0)