Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons. Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/52958 )
Change subject: buspirate_spi.c: Refactor singleton states into reentrant pattern ......................................................................
Patch Set 2:
(1 comment)
File buspirate_spi.c:
https://review.coreboot.org/c/flashrom/+/52958/comment/86e2fc8a_ed592dab PS2, Line 167: struct buspirate_spi_data *buspirate_data = data;
I can probably create bp_commbuf as a local variable, alloc at the beginning and free at the end. […]
Thank you so much for detailed explanation, and I am really sorry for delay from my side! During last week, I was opening this every day, re-reading, and trying to understand what to do. I think I need to ask another question or two to fully understand.
So if I take the approach of allocating maximum all the time, that would mean commbuf_grow is never needed, but that would use a lot more memory? Especially if "create bp_commbuf as a local variable, alloc at the beginning and free at the end."
If malloc() and free() are not expensive, only realloc() is then maybe I can leave size as is, just use local variable everywhere - because the number of reallocs won't change anyway?