Skip to content

Commit df7ac07

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

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);
@@ -913,7 +913,7 @@ void setrestrictions()
913913

914914
/* Put the child process in the cgroup */
915915
if (is_cgroup_v2) {
916-
const char *controllers[] = { "memory", NULL };
916+
const char *controllers[] = { "memory", nullptr };
917917
if (cgroup_change_cgroup_path(cgroupname, getpid(), controllers) != 0) {
918918
error(0, "Failed to move the process to the cgroup");
919919
}
@@ -962,7 +962,7 @@ void setrestrictions()
962962
/* Set group-id (must be root for this, so before setting user). */
963963
if ( use_group ) {
964964
if ( setgid(rungid) ) error(errno,"cannot set group ID to `%d'",rungid);
965-
if ( setgroups(0, NULL) ) error(errno,"cannot clear auxiliary groups");
965+
if ( setgroups(0, nullptr) ) error(errno,"cannot clear auxiliary groups");
966966

967967
verbose("using group ID `%d'",rungid);
968968
}
@@ -1128,7 +1128,7 @@ int main(int argc, char **argv)
11281128
case 'u': /* user option: uid or string */
11291129
use_user = 1;
11301130
runuser = strdup(optarg);
1131-
if ( runuser==NULL ) error(errno,"strdup() failed");
1131+
if ( runuser==nullptr ) error(errno,"strdup() failed");
11321132
errno = 0;
11331133
runuid = strtol(optarg,&ptr,10);
11341134
if ( errno || *ptr!='\0' ) {
@@ -1145,7 +1145,7 @@ int main(int argc, char **argv)
11451145
case 'g': /* group option: gid or string */
11461146
use_group = 1;
11471147
rungroup = strdup(optarg);
1148-
if ( rungroup==NULL ) error(errno,"strdup() failed");
1148+
if ( rungroup==nullptr ) error(errno,"strdup() failed");
11491149
errno = 0;
11501150
rungid = strtol(optarg,&ptr,10);
11511151
if ( errno || *ptr!='\0' ) rungid = groupid(optarg);
@@ -1498,7 +1498,7 @@ int main(int argc, char **argv)
14981498
}
14991499
}
15001500

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

0 commit comments

Comments
 (0)