As suggested by Jakub Zawadzki:

Rename g_gnuc_malloc.h to g_gnuc.h (since it contains non-malloc related
GNUC stuff).

Use G_GNUC_WARN_UNUSED_RESULT from glib instead of using warn_unused_result
directly.

svn path=/trunk/; revision=36825
This commit is contained in:
Jeff Morriss 2011-04-22 17:57:10 +00:00
parent 939731ee8e
commit ecf8cbed34
3 changed files with 13 additions and 14 deletions

View File

@ -26,7 +26,8 @@
#ifndef __EMEM_H__
#define __EMEM_H__
#include "g_gnuc_malloc.h"
#include "g_gnuc.h"
/** @file
*/
/** Initialize all the memory allocation pools described below.

View File

@ -1,5 +1,5 @@
/* g_gnuc_malloc.h
* Definitions of macro to conditionally do GCC malloc optimization
/* g_gnuc.h
* Definitions of macros to conditionally do GCC optimization or code checks
*
* $Id$
*
@ -22,8 +22,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __G_GNUC_MALLOC_H__
#define __G_GNUC_MALLOC_H__
#ifndef __G_GNUC_H__
#define __G_GNUC_H__
/**
* GLib 2.6 has the ability to enable better optimization of malloc functions.
@ -38,4 +38,8 @@
#define G_GNUC_NULL_TERMINATED
#endif
#endif /* g_gnuc_malloc.h */
#if ! GLIB_CHECK_VERSION(2,10,0)
#define G_GNUC_WARN_UNUSED_RESULT
#endif
#endif /* g_gnuc.h */

View File

@ -51,6 +51,7 @@
#include "tvbuff.h"
#include "ftypes/ftypes.h"
#include "register.h"
#include "g_gnuc.h"
#ifdef __cplusplus
extern "C" {
@ -514,18 +515,11 @@ extern void proto_cleanup(void);
*/
extern gboolean proto_field_is_referenced(proto_tree *tree, int proto_id);
/* XXX where should this go? */
#ifdef __GNUC__
#define WARN_IF_UNUSED __attribute__ ((warn_unused_result))
#else
#define WARN_IF_UNUSED
#endif
/** Create a subtree under an existing item.
@param ti the parent item of the new subtree
@param idx one of the ett_ array elements registered with proto_register_subtree_array()
@return the new subtree */
extern proto_tree* proto_item_add_subtree(proto_item *ti, const gint idx) WARN_IF_UNUSED;
extern proto_tree* proto_item_add_subtree(proto_item *ti, const gint idx) G_GNUC_WARN_UNUSED_RESULT;
/** Get an existing subtree under an item.
@param ti the parent item of the subtree