Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 44316: /trunk/ui/gtk/ /trunk/ui/gtk/
From: Martin Mathieson <martin.r.mathieson@xxxxxxxxxxxxxx>
Date: Tue, 7 Aug 2012 21:01:48 -0400


On Tue, Aug 7, 2012 at 7:16 PM, Joerg Mayer <jmayer@xxxxxxxxx> wrote:
On Tue, Aug 07, 2012 at 11:04:48PM +0000, martinm@xxxxxxxxxxxxx wrote:
> http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=44316
>
> User: martinm
> Date: 2012/08/07 04:04 PM
>
> Log:
>  Do the cross like it is in rlc_lte_graph.c, i.e. by just drawing black
>  lines, then erasing by re-showing the current pixmap.
>
> Directory: /trunk/ui/gtk/
>   Changes    Path           Action
>   +31 -38    tcp_graph.c    Modified

Naive question: Why isn't that cross handling code shared between the two
files?

Thanks
    Jörg
--

I think it was Guy that asked before about factoring out code that is common between the 2 modules.  I really dislike that there is identical code in both modules.  I did start to make a list of types and functions that could be shared, but it quickly looked messy.  I couldn't even decide what to call the new module (was it just to be shared between these 2 files, or would it likely be useful for someone creating a third module like these?).

rlc_lte_graph.c began as a copy of tcp_graph.c.  Initially there were some features that I didn't like (or in some cases didn't understand) so cut them out.  Some of them I have since added back, with improvements copied back to the TCP graph.  The biggest change is that I didn't want to have the control window, so there are various places where I cut out references to the controls in the control panel that affects behaviour of the graph, then tried to automatically do the sensible thing (e.g. customising the way the zoom factors work, or the way the divisions on the axis work).

Even where some functions are textually the same, they often refer to types (chiefly the graph struct) that are different between the 2 graphs.  This could have worked well in C++...

I will stop messing around with the RLC graph soon - it may be easier to see how to share what they have in common when it has settled down.

Martin