@cryptotaxi247 / netdata-1 / commits / 53fe93d7e

moved code to allow it compile with clang

Costa Tsaousis committed May 10, 2016 at 04:32 UTC 53fe93d7efe6f8256df991a5e6cd298f718dd379
1 file changed +22 -20
src/registry.c
+22 -20
@@ -803,6 +803,27 @@ PERSON *registry_request_delete(char *person_guid, char *machine_guid, char *url
803 return p;
804 }
805
806 +
807 +// a structure to pass to the dictionary_get_all() callback handler
808 +struct machine_request_callback_data {
809 + MACHINE *find_this_machine;
810 + PERSON_URL *result;
811 +};
812 +
813 +// the callback function
814 +// this will be run for every PERSON_URL of this PERSON
815 +int machine_request_callback(void *entry, void *data) {
816 + PERSON_URL *mypu = (PERSON_URL *)entry;
817 + struct machine_request_callback_data *myrdata = (struct machine_request_callback_data *)data;
818 +
819 + if(mypu->machine == myrdata->find_this_machine) {
820 + myrdata->result = mypu;
821 + return -1; // this will also stop the walk through
822 + }
823 +
824 + return 0; // continue
825 +}
826 +
827 MACHINE *registry_request_machine(char *person_guid, char *machine_guid, char *url, char *request_machine, time_t when) {
828 (void)when;
829
@@ -831,27 +852,8 @@ MACHINE *registry_request_machine(char *person_guid, char *machine_guid, char *u
852 // We will walk through the PERSON_URLs to find the machine
853 // linking to our machine
854
834 - // C magic !
835 -
855 // a structure to pass to the dictionary_get_all() callback handler
837 - struct machine_request_callback_data {
838 - MACHINE *find_this_machine;
839 - PERSON_URL *result;
840 - } rdata = { m, NULL };
841 -
842 - // the callback function
843 - // this will be run for every PERSON_URL of this PERSON
844 - int machine_request_callback(void *entry, void *data) {
845 - PERSON_URL *mypu = (PERSON_URL *)entry;
846 - struct machine_request_callback_data *myrdata = (struct machine_request_callback_data *)data;
847 -
848 - if(mypu->machine == myrdata->find_this_machine) {
849 - myrdata->result = mypu;
850 - return -1; // this will also stop the walk through
851 - }
852 -
853 - return 0; // continue
854 - }
856 + struct machine_request_callback_data rdata = { m, NULL };
857
858 // request a walk through on the dictionary
859 // no need for locking here, the underlying dictionary has its own