xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* usage of libxl__sprintf for flexarray_append
@ 2014-03-17  9:15 Olaf Hering
  2014-03-17  9:24 ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Olaf Hering @ 2014-03-17  9:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian.Jackson, Ian.Campbell


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: usage of libxl__sprintf for flexarray_append
  2014-03-17  9:15 usage of libxl__sprintf for flexarray_append Olaf Hering
@ 2014-03-17  9:24 ` Ian Campbell
  2014-03-17  9:27   ` Olaf Hering
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Campbell @ 2014-03-17  9:24 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Ian.Jackson, xen-devel

On Mon, 2014-03-17 at 10:15 +0100, Olaf Hering wrote:
> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: usage of libxl__sprintf for flexarray_append
  2014-03-17  9:24 ` Ian Campbell
@ 2014-03-17  9:27   ` Olaf Hering
  0 siblings, 0 replies; 3+ messages in thread
From: Olaf Hering @ 2014-03-17  9:27 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ian.Jackson, xen-devel

On Mon, Mar 17, Ian Campbell wrote:

> I think it's just a historic accident. Feel free to fix.

Ok, thanks.

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-17  9:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-17  9:15 usage of libxl__sprintf for flexarray_append Olaf Hering
2014-03-17  9:24 ` Ian Campbell
2014-03-17  9:27   ` Olaf Hering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).