cpu_type.h: Allow cpu_type functions to be accessible from C.
This allows cpu_type.h to be used in C-based software, with the get_cpu_*() functions all accessible via C as well as C++ code. Tested changes with sysinfo, AboutHaiku and Pulse. Change-Id: Ide87d8e3f2ba5f0f1890f385b1ac90c677bcc274 Reviewed-on: https://review.haiku-os.org/c/1453 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
49f507c4b5
commit
6ee7bb4f7b
@@ -483,7 +483,7 @@ get_cpu_type(char *vendorBuffer, size_t vendorSize, char *modelBuffer,
|
|||||||
cpu_topology_node_info* topology = NULL;
|
cpu_topology_node_info* topology = NULL;
|
||||||
get_cpu_topology_info(NULL, &topologyNodeCount);
|
get_cpu_topology_info(NULL, &topologyNodeCount);
|
||||||
if (topologyNodeCount != 0)
|
if (topologyNodeCount != 0)
|
||||||
topology = new cpu_topology_node_info[topologyNodeCount];
|
topology = (cpu_topology_node_info*)calloc(topologyNodeCount, sizeof(cpu_topology_node_info));
|
||||||
get_cpu_topology_info(topology, &topologyNodeCount);
|
get_cpu_topology_info(topology, &topologyNodeCount);
|
||||||
|
|
||||||
enum cpu_platform platform = B_CPU_UNKNOWN;
|
enum cpu_platform platform = B_CPU_UNKNOWN;
|
||||||
@@ -507,7 +507,7 @@ get_cpu_type(char *vendorBuffer, size_t vendorSize, char *modelBuffer,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] topology;
|
free(topology);
|
||||||
|
|
||||||
vendor = get_cpu_vendor_string(cpuVendor);
|
vendor = get_cpu_vendor_string(cpuVendor);
|
||||||
if (vendor == NULL)
|
if (vendor == NULL)
|
||||||
@@ -529,7 +529,7 @@ get_rounded_cpu_speed(void)
|
|||||||
cpu_topology_node_info* topology = NULL;
|
cpu_topology_node_info* topology = NULL;
|
||||||
get_cpu_topology_info(NULL, &topologyNodeCount);
|
get_cpu_topology_info(NULL, &topologyNodeCount);
|
||||||
if (topologyNodeCount != 0)
|
if (topologyNodeCount != 0)
|
||||||
topology = new cpu_topology_node_info[topologyNodeCount];
|
topology = (cpu_topology_node_info*)calloc(topologyNodeCount, sizeof(cpu_topology_node_info));
|
||||||
get_cpu_topology_info(topology, &topologyNodeCount);
|
get_cpu_topology_info(topology, &topologyNodeCount);
|
||||||
|
|
||||||
uint64 cpuFrequency = 0;
|
uint64 cpuFrequency = 0;
|
||||||
@@ -539,7 +539,7 @@ get_rounded_cpu_speed(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] topology;
|
free(topology);
|
||||||
|
|
||||||
int target, frac, delta;
|
int target, frac, delta;
|
||||||
int freqs[] = { 100, 50, 25, 75, 33, 67, 20, 40, 60, 80, 10, 30, 70, 90 };
|
int freqs[] = { 100, 50, 25, 75, 33, 67, 20, 40, 60, 80, 10, 30, 70, 90 };
|
||||||
|
|||||||
Reference in New Issue
Block a user