Mercurial > mxe-octave
comparison installer-files/octave-launch.c @ 5984:532c6ba0156f
octave-launch: Fix error when counting processor cores (bug #61208).
* installer-files/octave-launch.c (get_num_physical_cores): Count offset between
structures in bytes.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 26 Nov 2021 22:54:08 +0100 |
parents | 1569a1d140ae |
children | 1b5d45d7afd4 |
comparison
equal
deleted
inserted
replaced
5983:ffbb9aea3c2a | 5984:532c6ba0156f |
---|---|
39 } | 39 } |
40 | 40 |
41 static size_t get_num_physical_cores (void) | 41 static size_t get_num_physical_cores (void) |
42 { | 42 { |
43 DWORD length; | 43 DWORD length; |
44 PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX lpi; | 44 void *lpi; |
45 BOOL res; | 45 BOOL res; |
46 size_t num_physical_cores; | 46 size_t num_physical_cores; |
47 size_t offset; | 47 size_t offset; |
48 | 48 |
49 length = 0; | 49 length = 0; |
50 GetLogicalProcessorInformationEx (RelationProcessorCore, NULL, &length); | 50 GetLogicalProcessorInformationEx (RelationProcessorCore, NULL, &length); |
51 if (GetLastError () != ERROR_INSUFFICIENT_BUFFER) | 51 if (GetLastError () != ERROR_INSUFFICIENT_BUFFER) |
52 return 0; | 52 return 0; |
53 | 53 |
54 lpi = malloc (length); | 54 lpi = malloc (length); |
55 res = GetLogicalProcessorInformationEx (RelationProcessorCore, lpi, &length); | 55 res = GetLogicalProcessorInformationEx |
56 (RelationProcessorCore, | |
57 (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) lpi, | |
58 &length); | |
56 if (! res) | 59 if (! res) |
57 { | 60 { |
58 free (lpi); | 61 free (lpi); |
59 return 0; | 62 return 0; |
60 } | 63 } |