From f682646a806b63afb06c0c8a21b0e392489476fc Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Mon, 9 Apr 2018 10:56:47 +0900 Subject: [PATCH] Change the return type for callbacks - The return type for callbacks was changed from 'void' to 'bool' in order to stop the iteration Change-Id: I2bd5661850658615a774e6d6b603394e94c91335 Signed-off-by: Junghoon Park --- idlc/c_gen/c_body_gen_base_cb.h | 6 ++++-- idlc/c_gen/c_header_gen_base_cb.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/idlc/c_gen/c_body_gen_base_cb.h b/idlc/c_gen/c_body_gen_base_cb.h index bb4f46e..aa0e527 100644 --- a/idlc/c_gen/c_body_gen_base_cb.h +++ b/idlc/c_gen/c_body_gen_base_cb.h @@ -120,7 +120,7 @@ $$ const char CB_STRUCT_ITERATOR[] = R"__c_cb( int rpc_port_$$_foreach_$$(rpc_port_$$_h h, - void (*callback)($$$$, void *user_data), void *user_data) + bool (*callback)($$$$, void *user_data), void *user_data) { if (!h || !callback) { dlog_print(DLOG_ERROR, LOG_TAG, "Invalid parameter"); @@ -288,7 +288,9 @@ R"__c_cb(do { continue; } - callback($$, user_data); + bool ret = callback($$, user_data); + if (!ret) + break; } } while (0); )__c_cb"; diff --git a/idlc/c_gen/c_header_gen_base_cb.h b/idlc/c_gen/c_header_gen_base_cb.h index 40a0560..b18fe19 100644 --- a/idlc/c_gen/c_header_gen_base_cb.h +++ b/idlc/c_gen/c_header_gen_base_cb.h @@ -56,7 +56,7 @@ int rpc_port_$$_get_$$(rpc_port_$$_h h, $$$$); const char CB_STRUCT_ITERATOR[] = R"__c_cb( int rpc_port_$$_foreach_$$(rpc_port_$$_h h, - void (*callback)($$$$, void *user_data), void *user_data); + bool (*callback)($$$$, void *user_data), void *user_data); )__c_cb"; const char CB_STRUCT_CLONER[] = -- 2.7.4