From patchwork Thu Jan 29 19:28:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 4845 Received: (qmail 15589 invoked by alias); 29 Jan 2015 19:28:49 -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 15504 invoked by uid 89); 29 Jan 2015 19:28:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 29 Jan 2015 19:28:45 +0000 Received: from EUSAAHC005.ericsson.se (Unknown_Domain [147.117.188.87]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id 6A.85.03307.2F63AC45; Thu, 29 Jan 2015 14:34:42 +0100 (CET) Received: from elxcz23q12-y4.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.87) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 29 Jan 2015 14:28:40 -0500 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH 2/6] Mention which return values need to be freed in lang_varobj_ops Date: Thu, 29 Jan 2015 14:28:32 -0500 Message-ID: <1422559716-5480-2-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1422559716-5480-1-git-send-email-simon.marchi@ericsson.com> References: <1422559716-5480-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes This is the result of a little bit of investigation of the C and Ada languages, as well as some common sense. gdb/ChangeLog: * varobj.h (lang_varobj_ops): Mention which return values need to be freed. --- gdb/varobj.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gdb/varobj.h b/gdb/varobj.h index 796b940..145b963 100644 --- a/gdb/varobj.h +++ b/gdb/varobj.h @@ -169,23 +169,28 @@ struct lang_varobj_ops /* The number of children of PARENT. */ int (*number_of_children) (struct varobj *parent); - /* The name (expression) of a root varobj. */ + /* The name (expression) of a root varobj. The returned value must be freed + by the caller. */ char *(*name_of_variable) (struct varobj *parent); - /* The name of the INDEX'th child of PARENT. */ + /* The name of the INDEX'th child of PARENT. The returned value must be + freed by the caller. */ char *(*name_of_child) (struct varobj *parent, int index); /* Returns the rooted expression of CHILD, which is a variable - obtain that has some parent. */ + obtain that has some parent. The returned value must be freed by the + caller. */ char *(*path_expr_of_child) (struct varobj *child); - /* The ``struct value *'' of the INDEX'th child of PARENT. */ + /* The ``struct value *'' of the INDEX'th child of PARENT. The returned + value must be freed by the caller. */ struct value *(*value_of_child) (struct varobj *parent, int index); /* The type of the INDEX'th child of PARENT. */ struct type *(*type_of_child) (struct varobj *parent, int index); - /* The current value of VAR. */ + /* The current value of VAR. The returned value must be freed by the + caller. */ char *(*value_of_variable) (struct varobj *var, enum varobj_display_formats format);