/* Abstract sequential list data type, with out-of-memory checking.
- Copyright (C) 2009-2012 Free Software Foundation, Inc.
+ Copyright (C) 2009-2013 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This program is free software: you can redistribute it and/or modify
#include "gl_list.h"
#include "xalloc.h"
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
+_GL_INLINE_HEADER_BEGIN
+#ifndef GL_XLIST_INLINE
+# define GL_XLIST_INLINE _GL_INLINE
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
/* These functions are thin wrappers around the corresponding functions with
_nx_ infix from gl_list.h. Upon out-of-memory, they invoke xalloc_die (),
instead of returning an error indicator. */
+#if 0 /* These are defined inline below. */
extern gl_list_t gl_list_create_empty (gl_list_implementation_t implementation,
gl_listelement_equals_fn equals_fn,
gl_listelement_hashcode_fn hashcode_fn,
extern gl_list_node_t gl_sortedlist_add (gl_list_t list,
gl_listelement_compar_fn compar,
const void *elt);
+#endif
-#if HAVE_INLINE
-
-# define gl_list_create_empty gl_list_create_empty_inline
-static inline gl_list_t
+GL_XLIST_INLINE gl_list_t
gl_list_create_empty (gl_list_implementation_t implementation,
gl_listelement_equals_fn equals_fn,
gl_listelement_hashcode_fn hashcode_fn,
return result;
}
-# define gl_list_create gl_list_create_inline
-static inline gl_list_t
+GL_XLIST_INLINE gl_list_t
gl_list_create (gl_list_implementation_t implementation,
gl_listelement_equals_fn equals_fn,
gl_listelement_hashcode_fn hashcode_fn,
return result;
}
-# define gl_list_node_set_value gl_list_node_set_value_inline
-static inline void
+GL_XLIST_INLINE void
gl_list_node_set_value (gl_list_t list, gl_list_node_t node, const void *elt)
{
int result = gl_list_node_nx_set_value (list, node, elt);
xalloc_die ();
}
-# define gl_list_set_at gl_list_set_at_inline
-static inline gl_list_node_t
+GL_XLIST_INLINE gl_list_node_t
gl_list_set_at (gl_list_t list, size_t position, const void *elt)
{
gl_list_node_t result = gl_list_nx_set_at (list, position, elt);
return result;
}
-# define gl_list_add_first gl_list_add_first_inline
-static inline gl_list_node_t
+GL_XLIST_INLINE gl_list_node_t
gl_list_add_first (gl_list_t list, const void *elt)
{
gl_list_node_t result = gl_list_nx_add_first (list, elt);
return result;
}
-# define gl_list_add_last gl_list_add_last_inline
-static inline gl_list_node_t
+GL_XLIST_INLINE gl_list_node_t
gl_list_add_last (gl_list_t list, const void *elt)
{
gl_list_node_t result = gl_list_nx_add_last (list, elt);
return result;
}
-# define gl_list_add_before gl_list_add_before_inline
-static inline gl_list_node_t
+GL_XLIST_INLINE gl_list_node_t
gl_list_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
{
gl_list_node_t result = gl_list_nx_add_before (list, node, elt);
return result;
}
-# define gl_list_add_after gl_list_add_after_inline
-static inline gl_list_node_t
+GL_XLIST_INLINE gl_list_node_t
gl_list_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
{
gl_list_node_t result = gl_list_nx_add_after (list, node, elt);
return result;
}
-# define gl_list_add_at gl_list_add_at_inline
-static inline gl_list_node_t
+GL_XLIST_INLINE gl_list_node_t
gl_list_add_at (gl_list_t list, size_t position, const void *elt)
{
gl_list_node_t result = gl_list_nx_add_at (list, position, elt);
return result;
}
-# define gl_sortedlist_add gl_sortedlist_add_inline
-static inline gl_list_node_t
+GL_XLIST_INLINE gl_list_node_t
gl_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar,
const void *elt)
{
return result;
}
-#endif
-
#ifdef __cplusplus
}
#endif
+_GL_INLINE_HEADER_END
+
#endif /* _GL_XLIST_H */