low-can-cb: Little opti 79/23379/3
authorRomain Forlot <romain.forlot@iot.bzh>
Tue, 10 Dec 2019 18:02:36 +0000 (19:02 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Thu, 9 Jan 2020 15:25:36 +0000 (16:25 +0100)
Change-Id: I6f3e84700563fc60e643d770365c98342214bedd
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
low-can-binding/binding/low-can-cb.cpp

index 1ebb392..0bee7ef 100644 (file)
@@ -394,11 +394,9 @@ static int process_one_subscribe_args(afb_req_t request, bool subscribe, json_ob
        // 2 cases : ID(PGN) and event
 
        json_object_object_get_ex(args,"event",&event);
-       json_bool test_id = json_object_object_get_ex(args,"id",&id);
-       if(!test_id)
-               test_id = json_object_object_get_ex(args,"pgn",&id);
+       json_object_object_get_ex(args,"id",&id) || json_object_object_get_ex(args,"pgn",&id);
 
-       if(     args == NULL || (id && ((std::string)json_object_get_string(id)).compare("*") == 0))
+       if( args == NULL || (id && ((std::string)json_object_get_string(id)).compare("*") == 0))
        {
                rc = one_subscribe_unsubscribe_events(request, subscribe, "*", args);
        }