Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
2 comments:
File buspirate_spi.c:
Patch Set #3, Line 58: unsigned char **bp_commbuf
I'd just pass a pointer to `struct bp_spi_data`
I was considering the idea to pass a pointer to `struct bp_spi_data` into buspirate_commbuf_grow but it didn't look great [to me] in init function.
Init function is quite long, and I wanted to use local variables for bp_commbuf and bp_commbufsize in init function to minimize diffs and noise. But at the same time, buspirate_commbuf_grow is called twice in the middle of init function, and each of those calls can change the pointer and the size.
So, if I would need to pass data struct into buspirate_commbuf_grow, and also using local variables during init, that would mean:
assigning local values into data,
calling buspirate_commbuf_grow,
and then assigning updated values from data into local variables.
Patch Set #3, Line 221: unsigned char *const bp_commbuf = bp_data->bp_commbuf;
I thought that buspirate_commbuf_grow can change the pointer, and I can have this local variable as […]
As I learned today from C standard, realloc can change the pointer. And because I want this to be a constant pointer, I only can define it after the call to buspirate_commbuf_grow (because it does realloc).
To view, visit change 52958. To unsubscribe, or for help writing mail filters, visit settings.