equal
deleted
inserted
replaced
100 * callback to the generated function, the defaultCb will be set instead (with conn |
100 * callback to the generated function, the defaultCb will be set instead (with conn |
101 * as the context). |
101 * as the context). |
102 */ |
102 */ |
103 #define GENERATE_CB_SETTER(cbName, cbParameterTypes, defaultCb) \ |
103 #define GENERATE_CB_SETTER(cbName, cbParameterTypes, defaultCb) \ |
104 void flib_netconn_##cbName(flib_netconn *conn, void (*callback)cbParameterTypes, void *context) { \ |
104 void flib_netconn_##cbName(flib_netconn *conn, void (*callback)cbParameterTypes, void *context) { \ |
105 if(!conn) { \ |
105 if(!log_badargs_if(conn==NULL)) { \ |
106 flib_log_e("null parameter in flib_netconn_%s", #cbName); \ |
|
107 } else { \ |
|
108 conn->cbName##Cb = callback ? callback : &defaultCb; \ |
106 conn->cbName##Cb = callback ? callback : &defaultCb; \ |
109 conn->cbName##Ctx = callback ? context : conn; \ |
107 conn->cbName##Ctx = callback ? context : conn; \ |
110 } \ |
108 } \ |
111 } |
109 } |
112 |
110 |