[at-spi2-core: 1/47] Introduction: start refactoring into marshalers and translators




commit 9df891998bfb45432f7dd4d020d3f9f5ba4b1b92
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Jul 7 17:39:38 2022 -0500

    Introduction: start refactoring into marshalers and translators
    
    I want to move from the old libdbus, and the dbind/droute utilities,
    to automatically-generated code and all the amenities of gdbus.
    
    However, a lot of the code looks like this:
    
      static void
      handle_some_method (DBusMessage *message)
      {
        foo = demarshal_a_bit ();
        bar = find_the_accessible ();
        bar_set_foo (bar, foo);
    
        baz = demarshal_a_bit ();
        bar_set_baz (bar, baz);
    
        while (some_logic_here)
        {
          qux = demarshal_something ();
          blah_blah (qux, bar);
        }
    
        /* etc */
      }
    
    My plan is to first split that code into a part that
    marshals/demarshals everything to "easy" structs, and then a part that
    plugs those structs to the actual logic:
    
      typedef struct {
        Accessible accessible;
        Foo foo;
        Baz baz;
        Qux quxes[];
      } SomeMethodArgs;
    
      handle_some_method (DBusMessage *message)
      {
        SomeMethodArgs args;
    
        if (demarshal_some_method_args (message, &args) != SUCCESS)
        {
          return ERROR;
        }
    
        do_the_thing (args.accessible, args.foo, args.baz, args.quxes);
      }
    
    Once everything is split apart, it should be easier to just rewrite
    the marshaling code with gdbus stuff or even auto-generated code.
    Hopefully the logic can remain mostly unchanged.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]