[Spice-devel] OT Re: [spice-gtk] glz: Remove unused DECODE_TO_SAME array

Frediano Ziglio fziglio at redhat.com
Wed May 17 08:14:58 UTC 2017


> 
> Hi,
> 
> On Tue, May 16, 2017 at 12:29:16PM -0400, Frediano Ziglio wrote:
> > My script says (not checked):
> 
> Can you share it? :)
> 

This is the spice-server version https://cgit.freedesktop.org/~fziglio/script-utils/tree/spice-server/unused.pl.
It's quite manual at the moment, I usually copy and change for the
different projects. In case of spice-gtk I changed the export file
and reading code and list of paths.
Basically take all global symbols, remove ones exported or with relocations
and print (for unused).

> > Unused functions:
> > 	canvas_create
> > 	g_cclosure_user_marshal_VOID__OBJECT_OBJECT
> > 	spice_display_get_pixbuf
> > 	spice_display_key_event_get_type
> > 	spice_display_mouse_ungrab
> > 	spice_display_new
> 
> Does your script check for unused *exported* functions too? Although
> this is on src/map-file it isn't used in spicy or virt-viewer at least
> (only spice_display_new_with_monitor() is used)
> 

No, I assume exported means used by some external tools (so cannot check)
and part of the ABI (so better to retain). But can be changed if they are
used just by known tools (spicy?).

> > 	spice_display_send_keys
> > 	spice_grab_sequence_get_type
> > 	spice_grab_sequence_new
> > 	spice_msg_in_hexdump
> > 	spice_msg_out_hexdump
> > 	spice_msg_out_ref
> > 	spice_session_set_main_channel
> > 	vnc_display_keyval_free_entries
> > 	vnc_display_keyval_from_keycode
> > 	vnc_display_keyval_set_entries
> > Can be static functions:
> > 	coroutine_release
> > 	coroutine_swap
> > 	spice_desktop_integration_get_type
> > 	spice_gstaudio_get_type
> > 	spice_gtk_session_get_type
> > 	spice_image_compress_get_type
> > 	spice_msg_in_new
> > 	spice_msg_in_sub_new
> > 	spice_pulse_get_type
> > 	spice_session_get_shared_dir
> > 	spice_session_set_shared_dir
> > 	spice_usb_device_get_busnum
> > 	spice_usb_device_get_devaddr
> > 	spice_usb_device_widget_get_type
> > 	spice_vmc_output_stream_get_type
> > 	spice_vmc_stream_get_type
> >
> > Frediano
> 
> Would be nice to make the ones that can be static before the next
> release and checking what can be removed/deprecated from the non used
> ones..
> 

Note that the scripts just uses object file from current compiled
code, so for instance maybe compiling with different options (or
for different target) can lead different results and they should
be checked manually.

> 
> >
> > ----- Original Message -----
> > > From: "Christophe Fergeau" <cfergeau at redhat.com>
> > > To: spice-devel at lists.freedesktop.org
> > > Sent: Tuesday, May 16, 2017 4:12:42 PM
> > > Subject: [Spice-devel] [spice-gtk] glz: Remove unused DECODE_TO_SAME
> > > array
> > > 
> > > This also removes the generation of unneeded _decode methods once this
> > > array is removed (this causes some warnings otherwise).
> > > 
> > > DECODE_TO_SAME was used in the old client, but was never used when this
> > > code was moved over to spice-gtk.
> > > 
> > > Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> > > ---
> > >  src/decode-glz.c | 21 ---------------------
> > >  1 file changed, 21 deletions(-)
> > > 
> > > diff --git a/src/decode-glz.c b/src/decode-glz.c
> > > index d5b72ab5..27765393 100644
> > > --- a/src/decode-glz.c
> > > +++ b/src/decode-glz.c
> > > @@ -238,9 +238,6 @@ typedef uint16_t rgb16_pixel_t;
> > >  #undef ATTR_PACKED
> > >  
> > >  #define LZ_PLT
> > > -#include "decode-glz-tmpl.c"
> > > -
> > > -#define LZ_PLT
> > >  #define PLT8
> > >  #define TO_RGB32
> > >  #include "decode-glz-tmpl.c"
> > > @@ -267,14 +264,9 @@ typedef uint16_t rgb16_pixel_t;
> > >  
> > >  
> > >  #define LZ_RGB16
> > > -#include "decode-glz-tmpl.c"
> > > -#define LZ_RGB16
> > >  #define TO_RGB32
> > >  #include "decode-glz-tmpl.c"
> > >  
> > > -#define LZ_RGB24
> > > -#include "decode-glz-tmpl.c"
> > > -
> > >  #define LZ_RGB32
> > >  #include "decode-glz-tmpl.c"
> > >  
> > > @@ -302,19 +294,6 @@ const decode_function DECODE_TO_RGB32[] = {
> > >      glz_rgb32_decode
> > >  };
> > >  
> > > -const decode_function DECODE_TO_SAME[] = {
> > > -    NULL,
> > > -    glz_plt_decode,
> > > -    glz_plt_decode,
> > > -    glz_plt_decode,
> > > -    glz_plt_decode,
> > > -    glz_plt_decode,
> > > -    glz_rgb16_decode,
> > > -    glz_rgb24_decode,
> > > -    glz_rgb32_decode,
> > > -    glz_rgb32_decode
> > > -};
> > > -
> > >  static uint32_t decode_32(GlibGlzDecoder *d)
> > >  {
> > >      uint32_t word = 0;
> > 


More information about the Spice-devel mailing list