wayland-tbm-monitor: change signature of tbm_bufmgr_debug_tbm_info_get 43/144743/6
authorRoman Marchenko <r.marchenko@samsung.com>
Thu, 17 Aug 2017 16:36:26 +0000 (19:36 +0300)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 18 Aug 2017 02:38:15 +0000 (02:38 +0000)
Change-Id: I3cd81c5285d870d59ae0eeaefcf99553cf42be27
Signed-off-by: Roman Marchenko <r.marchenko@samsung.com>
src/wayland-tbm-client.c
src/wayland-tbm-monitor-server.c

index a175a44..94feec9 100644 (file)
@@ -237,8 +237,7 @@ void _waylend_tbm_monitor_client_show(int argc, char *argv[],
                                      char *reply, int *len, struct wayland_tbm_client *tbm_client)
 {
        struct wayland_tbm_monitor_path path = {0};
-       char show_str[1024*4] = {0,};
-       int show_len = sizeof(show_str);
+       char *show_str;
 
        _wayland_tbm_util_show_path_parse(argv[2], 0, &path);
 
@@ -246,8 +245,12 @@ void _waylend_tbm_monitor_client_show(int argc, char *argv[],
                tbm_bufmgr_debug_show(tbm_client->bufmgr);
 
        /* we have to save result to some file as reply can be very long */
-       tbm_bufmgr_debug_tbm_info_get(tbm_client->bufmgr, show_str, &show_len);
-       _waylend_tbm_monitor_client_print_show_to_file(show_str);
+       show_str = tbm_bufmgr_debug_tbm_info_get(tbm_client->bufmgr);
+       if (show_str) {
+               _waylend_tbm_monitor_client_print_show_to_file(show_str);
+               free(show_str);
+       }
+
 
        /* send empty string to close the session */
        WL_TBM_MONITOR_SNPRINTF(reply, *len, "\n");
index 45640f6..d8a0cf5 100644 (file)
@@ -288,9 +288,8 @@ static void
 _waylend_tbm_monitor_server_show(struct wayland_tbm_monitore_request *r)
 {
        struct wayland_tbm_monitor_target target = {0};
-       FILE * f = NULL;
-       char show_str[1024*4] = {0,};
-       int len = sizeof(show_str);
+       FILE *f = NULL;
+       char *show_str;
 
        if (!_waylend_tbm_util_target_parse(r->argv[1], &target)) {
                _wayland_tbm_monitor_request_printf(r, "'%s' - unknown target for -show\n", r->argv[1]);
@@ -307,7 +306,8 @@ _waylend_tbm_monitor_server_show(struct wayland_tbm_monitore_request *r)
        }
 
        if (target.server) {
-               tbm_bufmgr_debug_tbm_info_get(r->tbm_srv->bufmgr, show_str, &len);
+               show_str = tbm_bufmgr_debug_tbm_info_get(r->tbm_srv->bufmgr);
+               WL_TBM_RETURN_IF_FAIL(show_str);
 
                if (r->path.console && r->console)
                        fprintf(r->console, "%s", show_str);
@@ -322,6 +322,8 @@ _waylend_tbm_monitor_server_show(struct wayland_tbm_monitore_request *r)
                                                                                                        r->path.file);
                }
 
+               free(show_str);
+
                if (r->path.dlog)
                        tbm_bufmgr_debug_show(r->tbm_srv->bufmgr);
        }