libxl: change most remaining LIBXL_LOG to LOG in libxl_qmp.c
A message that is not in the archive (sent off-list or not yet received): [PATCH OPW 01/11] libxl: change most remaining LIBXL_LOG to LOG
in libxl_qmp.c
PATCH v2 1/1 libxl: change most remaining LIBXL_LOG to LOG in libxl_qmp.c
Coding style has recently been changed for libxl. The convenience macro LOG() has been introduced, and invocations of the old macro LIBXL__LOG() are to be replaced with it. Change occurences of the old macro to the new one in the functions qmp_handle_response() and qmp_handle_error_response(). The new macros need access to a local libxl__gc *gc, so add it as a parameter to both these functions, and pass the instance in qmp_next() down the call chain to qmp_handle_response() and in turn to qmp_handle_error_response().
---
Changes since v1: removed <TAB>s
tools/libxl/libxl_qmp.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
tools/libxl/libxl_qmp.c +10 -12
@@ -260,7 +260,7 @@ static callback_id_pair *qmp_get_callback_from_id(libxl__qmp_handler *qmp,return NULL ; } -static void qmp_handle_error_response (libxl__qmp_handler *qmp, +static void qmp_handle_error_response (libxl__gc *gc,libxl__qmp_handler *qmp,const libxl__json_object *resp) {callback_id_pair *pp =qmp_get_callback_from_id (qmp, resp);
@@ -283,19 +283,17 @@ static void qmp_handle_error_response(libxl__qmp_handler *qmp,free (pp); } -LIBXL__LOG (qmp->ctx,LIBXL__LOG_ERROR , -"received an error message from QMP server: %s" , -libxl__json_object_get_string (resp)); +LOG (ERROR ,"received an error message from QMP server: %s" , +libxl__json_object_get_string (resp)); } -static int qmp_handle_response (libxl__qmp_handler *qmp, +static int qmp_handle_response (libxl__gc *gc,libxl__qmp_handler *qmp,const libxl__json_object *resp) {libxl__qmp_message_type type =LIBXL__QMP_MESSAGE_TYPE_INVALID ; type =qmp_response_type (qmp, resp); -LIBXL__LOG (qmp->ctx,LIBXL__LOG_DEBUG , -"message type: %s" ,libxl__qmp_message_type_to_string (type)); +LOG (DEBUG ,"message type: %s" ,libxl__qmp_message_type_to_string (type));switch (type) {case LIBXL__QMP_MESSAGE_TYPE_QMP :
@@ -317,14 +315,14 @@ static int qmp_handle_response(libxl__qmp_handler *qmp,/* tell that the id have been processed */ qmp->wait_for_id =0 ; } -LIBXL_STAILQ_REMOVE ( - &qmp->callback_list, pp, callback_id_pair, next); +LIBXL_STAILQ_REMOVE (&qmp->callback_list, pp, callback_id_pair, + next);free (pp); } -return 0 ; +return 0 ; }case LIBXL__QMP_MESSAGE_TYPE_ERROR : -qmp_handle_error_response (qmp, resp); +qmp_handle_error_response (gc, qmp, resp);return -1 ;case LIBXL__QMP_MESSAGE_TYPE_EVENT :return 0 ;
@@ -481,7 +479,7 @@ static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp) o =libxl__json_parse (gc, s);if (o) { - rc =qmp_handle_response (qmp, o); + rc =qmp_handle_response (gc, qmp, o); }else {LOG (ERROR ,"Parse error of : %s\n" , s);return -1 ;
Signature · 1 line
1.8.1.2
Quoted 9 lines · Kelley Nielsen
Coding style has recently been changed for libxl. The convenience macro
LOG()has been introduced, and invocations of the old macroLIBXL__LOG()are to be replaced with it. Change occurences of the old macro to the new one in the functionsqmp_handle_response()andqmp_handle_error_response(). The new macros need access to a locallibxl__gc*gc, so add it as a parameter to both these functions, and pass the instance inqmp_next()down the call chain toqmp_handle_response()and in turn toqmp_handle_error_response().
Quoted 3 lines
Suggested-by Anthony PERARD <[email protected]>Signed-off-by Kelley Nielsen <[email protected]>Reviewed-by Anthony PERARD <[email protected]>
Thanks, I've applied (see other mail) with one small tweak:
[...]
tools/libxl/libxl_qmp.c static int qmp_handle_response(libxl__qmp_handler *qmp, · line 322
Quoted 12 lines
tools/libxl/libxl_qmp.c +3
-3@@ -317,14 +315,14 @@ static int qmp_handle_response(libxl__qmp_handler *qmp,/* tell that the id have been processed */ qmp->wait_for_id =0 ; } -LIBXL_STAILQ_REMOVE ( - &qmp->callback_list, pp, callback_id_pair, next); +LIBXL_STAILQ_REMOVE (&qmp->callback_list, pp, callback_id_pair, + next);free (pp); } -return 0 ; +return 0 ;
I don't think this w/s change (the return bit, not the STAILQ bit) was intentional/desirable so I cut it out.