usage of libxl__sprintf for flexarray_append
What is the reason for code like this in device_disk_add?
flexarray_append(back, libxl__sprintf(gc, "%d", 1));
A few lines above a known value of 1 is written without sprintf, and later cdrom/disk and r/w is also written as string.
Olaf
Quoted 6 lines · Olaf Hering
What is the reason for code like this in
device_disk_add?flexarray_append(back, libxl__sprintf(gc, "%d", 1));A few lines above a known value of 1 is written without sprintf, and later cdrom/disk and r/w is also written as string.
I think it's just a historic accident. Feel free to fix.
If you are touching this stuff then IMHO the chains of flexarray_appends for key/value pairs should use flexarray_append_pair to make it clearer they are related, but perhaps that's a cleanup for another time.
Ian.
Quoted 1 line · Ian Campbell
I think it's just a historic accident. Feel free to fix.
Ok, thanks.
Quoted 3 lines
If you are touching this stuff then IMHO the chains of
flexarray_appendsfor key/value pairs should useflexarray_append_pairto make it clearer they are related, but perhaps that's a cleanup for another time.
I'm using this already for new code, and I plan to adjust other places in that file to make use of flexarray_append_pair.
Olaf