Skip to contentSkip to conversation

usage of libxl__sprintf for flexarray_append

DISCUSSION Olaf Hering 2 participants 3 messages Mar 17, 2014

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
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.

#2 lore raw
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_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.

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