On Thu, Oct 4, 2012 at 7:25 AM, Enlightenment SVN <
[email protected]> wrote:

> Log:
> PROTO/elocation: Use one address unmarshall function for calls and signals
>
> Author:       stefan
> Date:         2012-10-04 03:25:47 -0700 (Thu, 04 Oct 2012)
> New Revision: 77421
> Trac:         http://trac.enlightenment.org/e/changeset/77421
>
> Modified:
>   trunk/PROTO/elocation/src/lib/elocation.c
>
> Modified: trunk/PROTO/elocation/src/lib/elocation.c
> ===================================================================
> --- trunk/PROTO/elocation/src/lib/elocation.c   2012-10-04 10:25:43 UTC
> (rev 77420)
> +++ trunk/PROTO/elocation/src/lib/elocation.c   2012-10-04 10:25:47 UTC
> (rev 77421)
> @@ -45,9 +45,8 @@
>  }
>
>  static void
> -address_cb(void *data , const EDBus_Message *reply, EDBus_Pending
> *pending)
> +unmarshall_address(Elocation_Address *address, const EDBus_Message *reply)
>  {
> -   Elocation_Address address;
>     int32_t level, timestamp;
>     EDBus_Message_Iter *iter, *sub, *dict, *entry;
>     double horizontal;
> @@ -71,32 +70,32 @@
>
>         if (!strcmp(key, "country"))
>          {
> -            address.country = value;
> +            address->country = value;
>              printf("Key: %s, value: %s\n", key, value);
>

REALLY asking for trouble... value is a pointer to the wire-message and
will be freed afterwards, so you may end pointing at some point with
invalid access..



>           }
>         else if (!strcmp(key, "countrycode"))
>           {
> -            address.countrycode = value;
> +            address->countrycode = value;
>              printf("Key: %s, value: %s\n", key, value);
>           }
>         else if (!strcmp(key, "locality"))
>           {
> -            address.locality = value;
> +            address->locality = value;
>              printf("Key: %s, value: %s\n", key, value);
>           }
>         else if (!strcmp(key, "postalcode"))
>           {
> -            address.postalcode = value;
> +            address->postalcode = value;
>              printf("Key: %s, value: %s\n", key, value);
>           }
>         else if (!strcmp(key, "region"))
>           {
> -            address.region = value;
> +            address->region = value;
>              printf("Key: %s, value: %s\n", key, value);
>           }
>         else if (!strcmp(key, "timezone"))
>           {
> -            address.timezone = value;
> +            address->timezone = value;
>              printf("Key: %s, value: %s\n", key, value);
>           }
>      }
> @@ -107,10 +106,23 @@
>     accur.horizontal = horizontal;
>     accur.vertical = vertical;
>  }
> +
>  static void
> +address_cb(void *data , const EDBus_Message *reply, EDBus_Pending
> *pending)
> +{
> +   Elocation_Address *address;
> +
> +   address = malloc(sizeof(Elocation_Address));
> +   unmarshall_address(address, reply);
> +}
> +static void
>  address_signal_cb(void *data , const EDBus_Message *reply)
>  {
> -   address_cb(data, reply, NULL);
> +   Elocation_Address *address;
> +
> +   address = malloc(sizeof(Elocation_Address));
> +   unmarshall_address(address, reply);
> +   ecore_event_add(ELOCATION_EVENT_ADDRESS, address, NULL, NULL);
>  }
>
>  static void
>
>
>
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> _______________________________________________
> enlightenment-svn mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>



-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: [email protected]
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to