From patchwork Sun Nov 23 19:27:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 3861 Received: (qmail 14002 invoked by alias); 23 Nov 2014 19:27:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 13988 invoked by uid 89); 23 Nov 2014 19:27:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 23 Nov 2014 19:27:28 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sANJRRan009589 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Sun, 23 Nov 2014 14:27:27 -0500 Received: from host1.jankratochvil.net (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sANJRQZG005478 for ; Sun, 23 Nov 2014 14:27:26 -0500 Subject: [PATCH v4 01/14] introduce ui_file_write_for_put From: Jan Kratochvil To: gdb-patches@sourceware.org Date: Sun, 23 Nov 2014 20:27:25 +0100 Message-ID: <20141123192725.32193.77807.stgit@host1.jankratochvil.net> In-Reply-To: <20141123192713.32193.57150.stgit@host1.jankratochvil.net> References: <20141123192713.32193.57150.stgit@host1.jankratochvil.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-IsSubscribed: yes From: Tom Tromey This introduces a small helper function, ui_file_write_for_put. It is a wrapper for ui_write that is suitable for passing directly to ui_file_put. This patch also updates one existing spot to use this new function. 2014-10-07 Tom Tromey * ui-file.h (ui_file_write_for_put): Declare. * ui-file.c (ui_file_write_for_put): New function. * mi/mi-out.c (do_write): Remove. (mi_out_put): Use ui_file_write_for_put. --- gdb/ChangeLog | 7 +++++++ gdb/mi/mi-out.c | 8 +------- gdb/ui-file.c | 6 ++++++ gdb/ui-file.h | 6 ++++++ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 07dacc0..d6d2b49 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2014-10-07 Tom Tromey + + * ui-file.h (ui_file_write_for_put): Declare. + * ui-file.c (ui_file_write_for_put): New function. + * mi/mi-out.c (do_write): Remove. + (mi_out_put): Use ui_file_write_for_put. + 2014-11-23 Patrick Palka * MAINTAINERS (Write After Approval): Add myself. diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 6ec41e6..9f5d1c0 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -376,18 +376,12 @@ mi_out_rewind (struct ui_out *uiout) /* Dump the buffer onto the specified stream. */ -static void -do_write (void *data, const char *buffer, long length_buffer) -{ - ui_file_write (data, buffer, length_buffer); -} - void mi_out_put (struct ui_out *uiout, struct ui_file *stream) { mi_out_data *data = ui_out_data (uiout); - ui_file_put (data->buffer, do_write, stream); + ui_file_put (data->buffer, ui_file_write_for_put, stream); ui_file_rewind (data->buffer); } diff --git a/gdb/ui-file.c b/gdb/ui-file.c index 49607dc..e3c7ba2 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -223,6 +223,12 @@ ui_file_write (struct ui_file *file, } void +ui_file_write_for_put (void *data, const char *buffer, long length_buffer) +{ + ui_file_write (data, buffer, length_buffer); +} + +void ui_file_write_async_safe (struct ui_file *file, const char *buf, long length_buf) diff --git a/gdb/ui-file.h b/gdb/ui-file.h index 50c1333..29ce5e0 100644 --- a/gdb/ui-file.h +++ b/gdb/ui-file.h @@ -98,6 +98,12 @@ extern int ui_file_isatty (struct ui_file *); extern void ui_file_write (struct ui_file *file, const char *buf, long length_buf); +/* A wrapper for ui_file_write that is suitable for use by + ui_file_put. */ + +extern void ui_file_write_for_put (void *data, const char *buffer, + long length_buffer); + extern void ui_file_write_async_safe (struct ui_file *file, const char *buf, long length_buf);