Skip to content

Commit 5169f71

Browse files
committed
utils/hwloc: enforce using '\0' instead of 0
1 parent dc7b4b4 commit 5169f71

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

utils/hwloc/common-ps.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int hwloc_ps_read_process(hwloc_topology_t topology, hwloc_const_bitmap_t topocp
5757
free(path);
5858
goto out;
5959
}
60-
proc->name[n] = 0;
60+
proc->name[n] = '\0';
6161

6262
if (flags & HWLOC_PS_FLAG_SHORTNAME) {
6363
/* try to get a small name from comm */
@@ -68,9 +68,9 @@ int hwloc_ps_read_process(hwloc_topology_t topology, hwloc_const_bitmap_t topocp
6868
n = read(fd, comm, sizeof(comm) - 1);
6969
close(fd);
7070
if (n > 0) {
71-
comm[n] = 0;
71+
comm[n] = '\0';
7272
if (n > 1 && comm[n-1] == '\n')
73-
comm[n-1] = 0;
73+
comm[n-1] = '\0';
7474
}
7575

7676
} else {
@@ -85,12 +85,12 @@ int hwloc_ps_read_process(hwloc_topology_t topology, hwloc_const_bitmap_t topocp
8585
n = read(fd, stats, sizeof(stats) - 1);
8686
close(fd);
8787
if (n > 0) {
88-
stats[n] = 0;
88+
stats[n] = '\0';
8989
parenl = strchr(stats, '(');
9090
parenr = strchr(stats, ')');
9191
if (!parenr)
9292
parenr = &stats[sizeof(stats)-1];
93-
*parenr = 0;
93+
*parenr = '\0';
9494
if (parenl)
9595
snprintf(comm, sizeof(comm), "%s", parenl+1);
9696
}

utils/hwloc/hwloc-calc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ int main(int argc, char *argv[])
398398
if (equal) {
399399
cpukind_infoname = argv[1];
400400
cpukind_infovalue = equal+1;
401-
*equal = 0;
401+
*equal = '\0';
402402
} else if (argv[1][0] >= '0' && argv[1][0] <= '9') {
403403
cpukind_index = atoi(argv[1]);
404404
} else {

0 commit comments

Comments
 (0)