On Thu, Apr 14, 2016 at 05:52:33PM +0200, Peter Krempa wrote: > --- > examples/object-events/event-test.c | 31 ++++++++++++++++++++----------- > 1 file changed, 20 insertions(+), 11 deletions(-) > ACK > diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c > index 22bd706..e1ad990 100644 > --- a/examples/object-events/event-test.c > +++ b/examples/object-events/event-test.c > @@ -386,6 +386,24 @@ myDomainEventIOErrorCallback(virConnectPtr conn ATTRIBUTE_UNUSED, > } > > > +static const char * > +graphicsPhaseToStr(int phase) > +{ > + switch ((virDomainEventGraphicsPhase) phase) { > + case VIR_DOMAIN_EVENT_GRAPHICS_CONNECT: > + return "connected "; Adding the space in the caller would be neater. > + > + case VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE: > + return "initialized "; > + > + case VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT: > + return "disconnected "; > + } > + > + return "unknown"; This string does not have a trailing space. > +} > + > + > static int > myDomainEventGraphicsCallback(virConnectPtr conn ATTRIBUTE_UNUSED, > virDomainPtr dom, > @@ -400,17 +418,8 @@ myDomainEventGraphicsCallback(virConnectPtr conn ATTRIBUTE_UNUSED, > printf("%s EVENT: Domain %s(%d) graphics ", __func__, virDomainGetName(dom), > virDomainGetID(dom)); > > - switch (phase) { > - case VIR_DOMAIN_EVENT_GRAPHICS_CONNECT: > - printf("connected "); > - break; > - case VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE: > - printf("initialized "); > - break; > - case VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT: > - printf("disconnected "); > - break; > - } > + printf("%s", graphicsPhaseToStr(phase)); > + Why the extra newline? Jan -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list