mirror_qemu/ui
Eric Blake ddf2190896 qapi: Unbox base members
Rather than storing a base class as a pointer to a box, just
store the fields of that base class in the same order, so that
a child struct can be directly cast to its parent.  This gives
less malloc overhead, less pointer dereferencing, and even less
generated code.  Compare to the earlier commit 1e6c1616a "qapi:
Generate a nicer struct for flat unions" (although that patch
had fewer places to change, as less of qemu was directly using
qapi structs for flat unions).  It also allows us to turn on
automatic type-safe wrappers for upcasting to the base class
of a struct.

Changes to the generated code look like this in qapi-types.h:

| struct SpiceChannel {
|-    SpiceBasicInfo *base;
|+    /* Members inherited from SpiceBasicInfo: */
|+    char *host;
|+    char *port;
|+    NetworkAddressFamily family;
|+    /* Own members: */
|     int64_t connection_id;

as well as additional upcast functions like qapi_SpiceChannel_base().
Meanwhile, changes to qapi-visit.c look like:

| static void visit_type_SpiceChannel_fields(Visitor *v, SpiceChannel **obj, Error **errp)
| {
|     Error *err = NULL;
|
|-    visit_type_implicit_SpiceBasicInfo(v, &(*obj)->base, &err);
|+    visit_type_SpiceBasicInfo_fields(v, (SpiceBasicInfo **)obj, &err);
|     if (err) {

(the cast is necessary, since our upcast wrappers only deal with a
single pointer, not pointer-to-pointer); plus the wholesale
elimination of some now-unused visit_type_implicit_FOO() functions.

Without boxing, the corner case of one empty struct having
another empty struct as its base type now requires inserting a
dummy member (previously, the 'Base *base' member sufficed).

And now that we no longer consume a 'base' member in the generated
C struct, we can delete the former negative struct-base-clash-base
test.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1445898903-12082-11-git-send-email-eblake@redhat.com>
[Commit message tweaked slightly]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02 08:30:26 +01:00
..
shader console-gl: add opengl rendering helper functions 2015-05-05 10:48:22 +02:00
Makefile.objs gtk/opengl: add opengl context and scanout support (GtkGLArea) 2015-10-08 10:34:53 +02:00
cocoa.m ui/cocoa.m: blinky mouse cursor fix 2015-10-16 11:06:19 +01:00
console-gl.c shaders: initialize vertexes once 2015-10-08 10:31:35 +02:00
console.c qemu-char: convert vc backend to data-driven creation 2015-10-19 10:13:07 +02:00
curses.c input/curses: add kbd delay between keydown and keyup events 2014-06-04 08:40:42 +02:00
curses_keys.h janitor: add guards to headers 2012-12-19 08:31:31 +01:00
cursor.c ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
cursor_hidden.xpm ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
cursor_left_ptr.xpm ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
egl-context.c opengl: add egl-context.[ch] helpers 2015-10-08 10:34:53 +02:00
egl-helpers.c ui: add egl-helpers 2015-05-29 11:11:38 +02:00
gtk-egl.c gtk/opengl: add opengl context and scanout support (egl) 2015-10-08 10:34:53 +02:00
gtk-gl-area.c gtk/opengl: add opengl context and scanout support (GtkGLArea) 2015-10-08 10:34:53 +02:00
gtk.c qemu-char: convert vc backend to data-driven creation 2015-10-19 10:13:07 +02:00
input-keymap.c kbd: add brazil kbd keys to qemu 2015-05-29 10:30:06 +02:00
input-legacy.c Include monitor/monitor.h exactly where needed 2015-06-22 18:20:41 +02:00
input.c qerror: Move #include out of qerror.h 2015-06-22 18:20:40 +02:00
keymaps.c keymaps: correct keymaps.c following Qemu coding style 2014-12-10 10:08:12 +01:00
keymaps.h
qemu-pixman.c ui/pixman: add qemu_pixman_check_format 2015-01-19 13:33:26 +01:00
qemu-x509.h ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
sdl.c sdl2: add support for display rendering using opengl. 2015-05-05 10:48:26 +02:00
sdl2-2d.c sdl2: stop flickering 2015-10-08 10:31:35 +02:00
sdl2-gl.c sdl2: add support for display rendering using opengl. 2015-05-05 10:48:26 +02:00
sdl2-input.c sdl2: move SDL_* includes to sdl2.h 2015-05-05 10:48:26 +02:00
sdl2-keymap.h sdl2: keymap fixups 2014-09-16 08:07:05 +02:00
sdl2.c sdl2: fix crash in handle_windowevent() when restoring the screen size 2015-06-09 10:25:21 +02:00
sdl_keysym.h ui/sdl2 : initial port to SDL 2.0 (v2.0) 2014-03-05 09:52:05 +01:00
sdl_zoom.c sdl: Fix heap smash in sdl_zoom_rgb{16,32} for int > 32 bits 2013-01-15 18:25:30 -06:00
sdl_zoom.h
sdl_zoom_template.h sdl: Fix heap smash in sdl_zoom_rgb{16,32} for int > 32 bits 2013-01-15 18:25:30 -06:00
shader.c shaders: initialize vertexes once 2015-10-08 10:31:35 +02:00
spice-core.c qapi: Unbox base members 2015-11-02 08:30:26 +01:00
spice-display.c spice: surface switch fast path requires same format too. 2015-09-21 09:52:07 +02:00
spice-input.c spice: input: Fix absolute mouse y coordinates 2014-03-24 08:41:21 +01:00
vgafont.h ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
vnc-auth-sasl.c ui: convert VNC server to use QCryptoTLSSession 2015-09-15 15:20:55 +01:00
vnc-auth-sasl.h aio / timers: Untangle include files 2013-08-22 19:10:27 +02:00
vnc-auth-vencrypt.c ui: convert VNC server to use QCryptoTLSSession 2015-09-15 15:20:55 +01:00
vnc-auth-vencrypt.h
vnc-enc-hextile-template.h pixman/vnc: use pixman images in vnc. 2012-11-01 14:00:04 +01:00
vnc-enc-hextile.c pixman/vnc: remove dead code. 2012-11-01 14:00:05 +01:00
vnc-enc-tight.c vnc-enc-tight: fix Arguments in wrong order 2014-12-10 10:08:12 +01:00
vnc-enc-tight.h
vnc-enc-zlib.c
vnc-enc-zrle-template.c
vnc-enc-zrle.c pixman/vnc: use pixman images in vnc. 2012-11-01 14:00:04 +01:00
vnc-enc-zrle.h
vnc-enc-zywrle-template.c
vnc-enc-zywrle.h misc: Spelling and grammar fixes in comments 2013-10-26 13:06:45 +04:00
vnc-jobs.c Include monitor/monitor.h exactly where needed 2015-06-22 18:20:41 +02:00
vnc-jobs.h ui/vnc: Remove vnc_stop_worker_thread() 2015-03-10 08:15:33 +03:00
vnc-palette.c ui/vnc-palette.c: Include headers it needs 2012-12-06 09:17:05 +01:00
vnc-palette.h misc: move include files to include/qemu/ 2012-12-19 08:32:39 +01:00
vnc-ws.c ui: convert VNC server to use QCryptoTLSSession 2015-09-15 15:20:55 +01:00
vnc-ws.h ui: convert VNC server to use QCryptoTLSSession 2015-09-15 15:20:55 +01:00
vnc.c qapi: Unbox base members 2015-11-02 08:30:26 +01:00
vnc.h util: pull Buffer code out of VNC module 2015-10-20 14:59:09 +01:00
vnc_keysym.h qemu-char: add cyrillic characters 'numerosign' to VNC keysyms 2015-03-10 08:15:34 +03:00
x_keymap.c kbd: add brazil kbd keys to x11 evdev map 2015-05-29 10:30:06 +02:00
x_keymap.h