Chris Robinson wrote:
- /* End */
- {NULL, 0}
};
[..]
for (i = 0; i < (sizeof(EXTENSION_MAP) / sizeof(*EXTENSION_MAP)); ++i) {
for (i = 0; EXTENSION_MAP[i].extension_string; ++i) {
What was the reason for this change? It's a static const array why do you want to treat it as a dynamically sized one?
Vitaliy.
On Sunday 05 August 2007 02:23:11 pm Vitaliy Margolen wrote:
Chris Robinson wrote:
- /* End */
- {NULL, 0}
};
[..]
for (i = 0; i < (sizeof(EXTENSION_MAP) /
sizeof(*EXTENSION_MAP)); ++i) { + for (i = 0; EXTENSION_MAP[i].extension_string; ++i) {
What was the reason for this change? It's a static const array why do you want to treat it as a dynamically sized one?
Because at the time, I was attempting to track down memory corruption, and I didn't trust that the compiler wasn't adding an extra element to the list (due to the last specified element ending with a comma to signify another, and the array size not being explicit). Ending the array with a NULL would gaurantee you can't overrun it in either case.