unix: do not cast to char variables that are const char

Fix the casting of const char varaibles with const char returns from
functions, when the data being returned is not being modified.  Includes
the part revert of "unix: fix compilation warnings with GCC 15"

This reverts commit 50ed2fd7bd.
This commit is contained in:
Rudi Heitbaum 2026-03-05 03:05:22 +00:00
parent 090aeddafc
commit dbe4677ff0
3 changed files with 10 additions and 10 deletions

View File

@ -1209,7 +1209,7 @@ struct uv_cpu_times_s {
};
struct uv_cpu_info_s {
char* model;
const char* model;
int speed;
struct uv_cpu_times_s cpu_times;
};

View File

@ -470,12 +470,12 @@ UV_UNUSED(static void uv__update_time(uv_loop_t* loop)) {
loop->time = uv__hrtime(UV_CLOCK_FAST) / 1000000;
}
UV_UNUSED(static char* uv__basename_r(const char* path)) {
char* s;
UV_UNUSED(static const char* uv__basename_r(const char* path)) {
const char* s;
s = strrchr((char*) path, '/');
s = strrchr(path, '/');
if (s == NULL)
return (char*) path;
return path;
return s + 1;
}

View File

@ -1639,7 +1639,7 @@ done:
int uv_resident_set_memory(size_t* rss) {
char buf[1024];
char* s;
const char* s;
long val;
int rc;
int i;
@ -1900,7 +1900,7 @@ nocpuinfo:
c = *cpus + cpu;
(*ci)[i++] = (uv_cpu_info_t) {
.model = (char*) p + c->model * sizeof(*model),
.model = p + c->model * sizeof(*model),
.speed = c->freq / 1000,
/* Note: sysconf(_SC_CLK_TCK) is fixed at 100 Hz,
* therefore the multiplier is always 1000/100 = 10.
@ -2371,10 +2371,10 @@ next:
return 0;
}
static char* uv__cgroup1_find_cpu_controller(const char* cgroup,
static const char* uv__cgroup1_find_cpu_controller(const char* cgroup,
int* cgroup_size) {
/* Seek to the cpu controller line. */
char* cgroup_cpu = strstr((char*) cgroup, ":cpu,");
const char* cgroup_cpu = strstr(cgroup, ":cpu,");
if (cgroup_cpu != NULL) {
/* Skip the controller prefix to the start of the cgroup path. */
@ -2391,7 +2391,7 @@ static int uv__get_cgroupv1_constrained_cpu(const char* cgroup,
char path[256];
char buf[1024];
int cgroup_size;
char* cgroup_cpu;
const char* cgroup_cpu;
long long period_length;
long long quota_per_period;