Re: I don't understand this code

2006-08-11 Thread Dave Shield
> If you're going to malloc everything right away, why not just use an array > and skip the pointers. I haven't looked at the code in question, but the most likely explanation would be if you're going to re-size the array at a later date - expanding it if the number of sensors exceeds the initial

I don't understand this code

2006-08-11 Thread Bruce Shaw
(from agent/mibgroup/ucd-snmp/lmSensors.c -simplified for readability) typedef struct { charname[MAX_NAME]; int value; } _sensor; typedef struct { int n; _sensor*sensor; size_t current_len; } _sensor_array; for (i = 0; i < N_TYPES; i++){ /