From 414635ed213b0c3d3d3de91b6c8b7c8008d83035 Mon Sep 17 00:00:00 2001
From: Roman Tsisyk <roman@tarantool.org>
Date: Thu, 15 Jun 2017 20:44:04 +0300
Subject: [PATCH] Fix name clash in reflection.h

Rename `struct type` to `struct type_info` and `struct method` to
`struct method_info` to fix name clash with curl/curl.h
---
 src/box/error.cc            |  6 +--
 src/box/error.h             |  2 +-
 src/box/xlog.cc             |  8 ++--
 src/box/xlog.h              |  6 +--
 src/diag.c                  |  2 +-
 src/diag.h                  |  7 ++--
 src/exception.cc            | 29 +++++++-------
 src/exception.h             | 22 +++++------
 src/lua/init.lua            | 20 +++++-----
 src/reflection.c            |  8 ++--
 src/reflection.h            | 75 +++++++++++++++++++------------------
 src/sio.cc                  |  4 +-
 src/sio.h                   |  2 +-
 test/unit/reflection_c.c    |  6 +--
 test/unit/reflection_cxx.cc | 36 +++++++++---------
 15 files changed, 118 insertions(+), 115 deletions(-)

diff --git a/src/box/error.cc b/src/box/error.cc
index cc43c529d5..e3167231d0 100644
--- a/src/box/error.cc
+++ b/src/box/error.cc
@@ -94,13 +94,13 @@ const char *rmean_error_strings[RMEAN_ERROR_LAST] = {
 	"ERROR"
 };
 
-static struct method clienterror_methods[] = {
+static struct method_info clienterror_methods[] = {
 	make_method(&type_ClientError, "code", &ClientError::errcode),
 	METHODS_SENTINEL
 };
 
-const struct type type_ClientError = make_type("ClientError", &type_Exception,
-	clienterror_methods);
+const struct type_info type_ClientError =
+	make_type("ClientError", &type_Exception, clienterror_methods);
 
 ClientError::ClientError(const char *file, unsigned line,
 			 uint32_t errcode, ...)
diff --git a/src/box/error.h b/src/box/error.h
index 5d22bdf52c..06d4899580 100644
--- a/src/box/error.h
+++ b/src/box/error.h
@@ -120,7 +120,7 @@ box_error_set(const char *file, unsigned line, uint32_t code,
 
 /** \endcond public */
 
-extern const struct type type_ClientError;
+extern const struct type_info type_ClientError;
 
 #if defined(__cplusplus)
 } /* extern "C" */
diff --git a/src/box/xlog.cc b/src/box/xlog.cc
index 1c30c1a752..951262ed19 100644
--- a/src/box/xlog.cc
+++ b/src/box/xlog.cc
@@ -79,7 +79,7 @@ enum {
 	XLOG_TX_COMPRESS_THRESHOLD = 2 * 1024,
 };
 
-const struct type type_XlogError = make_type("XlogError", &type_Exception);
+const struct type_info type_XlogError = make_type("XlogError", &type_Exception);
 XlogError::XlogError(const char *file, unsigned line,
 		     const char *format, ...)
 	:Exception(&type_XlogError, file, line)
@@ -90,8 +90,8 @@ XlogError::XlogError(const char *file, unsigned line,
 	va_end(ap);
 }
 
-XlogError::XlogError(const struct type *type, const char *file, unsigned line,
-		     const char *format, ...)
+XlogError::XlogError(const struct type_info *type, const char *file,
+		     unsigned line, const char *format, ...)
 	:Exception(type, file, line)
 {
 	va_list ap;
@@ -100,7 +100,7 @@ XlogError::XlogError(const struct type *type, const char *file, unsigned line,
 	va_end(ap);
 }
 
-const struct type type_XlogGapError =
+const struct type_info type_XlogGapError =
 	make_type("XlogGapError", &type_XlogError);
 
 XlogGapError::XlogGapError(const char *file, unsigned line,
diff --git a/src/box/xlog.h b/src/box/xlog.h
index dc50ba09ed..253abfadaf 100644
--- a/src/box/xlog.h
+++ b/src/box/xlog.h
@@ -49,7 +49,7 @@ struct xrow_header;
 extern "C" {
 #endif /* defined(__cplusplus) */
 
-extern const struct type type_XlogError;
+extern const struct type_info type_XlogError;
 
 /* {{{ log dir */
 
@@ -672,8 +672,8 @@ struct XlogError: public Exception
 		  const char *format, ...);
 	virtual void raise() { throw this; }
 protected:
-	XlogError(const struct type *type, const char *file, unsigned line,
-		  const char *format, ...);
+	XlogError(const struct type_info *type, const char *file,
+		  unsigned line, const char *format, ...);
 };
 
 struct XlogGapError: public XlogError
diff --git a/src/diag.c b/src/diag.c
index 7d990e5668..248277e74d 100644
--- a/src/diag.c
+++ b/src/diag.c
@@ -37,7 +37,7 @@ struct error_factory *error_factory = NULL;
 void
 error_create(struct error *e,
 	     error_f destroy, error_f raise, error_f log,
-	     const struct type *type, const char *file, unsigned line)
+	     const struct type_info *type, const char *file, unsigned line)
 {
 	e->destroy = destroy;
 	e->raise = raise;
diff --git a/src/diag.h b/src/diag.h
index 044ff08613..d2f3ce4682 100644
--- a/src/diag.h
+++ b/src/diag.h
@@ -47,7 +47,7 @@ enum {
 	DIAG_FILENAME_MAX = 256
 };
 
-struct type;
+struct type_info;
 struct error;
 struct error_factory;
 extern struct error_factory *error_factory;
@@ -72,7 +72,7 @@ struct error {
 	error_f destroy;
 	error_f raise;
 	error_f log;
-	const struct type *type;
+	const struct type_info *type;
 	int refs;
 	/** Line number. */
 	unsigned line;
@@ -113,7 +113,8 @@ error_log(struct error *e)
 void
 error_create(struct error *e,
 	     error_f create, error_f raise, error_f log,
-	     const struct type *type, const char *file, unsigned line);
+	     const struct type_info *type, const char *file,
+	     unsigned line);
 
 void
 error_format_msg(struct error *e, const char *format, ...);
diff --git a/src/exception.cc b/src/exception.cc
index 0635eb3f0b..ad85380f0d 100644
--- a/src/exception.cc
+++ b/src/exception.cc
@@ -60,7 +60,7 @@ exception_log(struct error *error)
 }
 
 const char *
-exception_get_string(struct error *e, const struct method *method)
+exception_get_string(struct error *e, const struct method_info *method)
 {
 	/* A workaround for for vtable */
 	Exception *ex = (Exception *) e;
@@ -70,7 +70,7 @@ exception_get_string(struct error *e, const struct method *method)
 }
 
 int
-exception_get_int(struct error *e, const struct method *method)
+exception_get_int(struct error *e, const struct method_info *method)
 {
 	/* A workaround for vtable  */
 	Exception *ex = (Exception *) e;
@@ -85,12 +85,12 @@ exception_get_int(struct error *e, const struct method *method)
 static OutOfMemory out_of_memory(__FILE__, __LINE__,
 				 sizeof(OutOfMemory), "malloc", "exception");
 
-static const struct method exception_methods[] = {
+static const struct method_info exception_methods[] = {
 	make_method(&type_Exception, "message", &Exception::get_errmsg),
 	make_method(&type_Exception, "log", &Exception::log),
 	METHODS_SENTINEL
 };
-const struct type type_Exception = make_type("Exception", NULL,
+const struct type_info type_Exception = make_type("Exception", NULL,
 	exception_methods);
 
 void *
@@ -116,7 +116,7 @@ Exception::~Exception()
 	}
 }
 
-Exception::Exception(const struct type *type_arg, const char *file,
+Exception::Exception(const struct type_info *type_arg, const char *file,
 		     unsigned line)
 {
 	error_create(this, exception_destroy, exception_raise,
@@ -129,15 +129,15 @@ Exception::log() const
 	_say(S_ERROR, file, line, errmsg, "%s", type->name);
 }
 
-static const struct method systemerror_methods[] = {
+static const struct method_info systemerror_methods[] = {
 	make_method(&type_SystemError, "errno", &SystemError::get_errno),
 	METHODS_SENTINEL
 };
 
-const struct type type_SystemError = make_type("SystemError", &type_Exception,
-	systemerror_methods);
+const struct type_info type_SystemError =
+	make_type("SystemError", &type_Exception, systemerror_methods);
 
-SystemError::SystemError(const struct type *type,
+SystemError::SystemError(const struct type_info *type,
 			 const char *file, unsigned line)
 	:Exception(type, file, line),
 	m_errno(errno)
@@ -163,7 +163,7 @@ SystemError::log() const
 	     errmsg);
 }
 
-const struct type type_OutOfMemory =
+const struct type_info type_OutOfMemory =
 	make_type("OutOfMemory", &type_SystemError);
 
 OutOfMemory::OutOfMemory(const char *file, unsigned line,
@@ -176,7 +176,7 @@ OutOfMemory::OutOfMemory(const char *file, unsigned line,
 			 (unsigned) amount, allocator, object);
 }
 
-const struct type type_TimedOut =
+const struct type_info type_TimedOut =
 	make_type("TimedOut", &type_SystemError);
 
 TimedOut::TimedOut(const char *file, unsigned line)
@@ -186,7 +186,7 @@ TimedOut::TimedOut(const char *file, unsigned line)
 	error_format_msg(this, "timed out");
 }
 
-const struct type type_ChannelIsClosed =
+const struct type_info type_ChannelIsClosed =
 	make_type("ChannelIsClosed", &type_Exception);
 
 ChannelIsClosed::ChannelIsClosed(const char *file, unsigned line)
@@ -195,7 +195,7 @@ ChannelIsClosed::ChannelIsClosed(const char *file, unsigned line)
 	error_format_msg(this, "channel is closed");
 }
 
-const struct type type_FiberIsCancelled =
+const struct type_info type_FiberIsCancelled =
 	make_type("FiberIsCancelled", &type_Exception);
 
 FiberIsCancelled::FiberIsCancelled(const char *file, unsigned line)
@@ -212,7 +212,8 @@ FiberIsCancelled::log() const
 	say_info("fiber `%s': exiting", fiber_name(fiber()));
 }
 
-const struct type type_LuajitError = make_type("LuajitError", &type_Exception);
+const struct type_info type_LuajitError =
+	make_type("LuajitError", &type_Exception);
 
 LuajitError::LuajitError(const char *file, unsigned line,
 			 const char *msg)
diff --git a/src/exception.h b/src/exception.h
index ed87ade341..56da6c6eb6 100644
--- a/src/exception.h
+++ b/src/exception.h
@@ -37,7 +37,7 @@
 #include "reflection.h"
 #include "diag.h"
 
-extern const struct type type_Exception;
+extern const struct type_info type_Exception;
 
 class Exception: public error {
 public:
@@ -56,10 +56,10 @@ class Exception: public error {
 	Exception(const Exception &) = delete;
 	Exception& operator=(const Exception&) = delete;
 protected:
-	Exception(const struct type *type, const char *file, unsigned line);
+	Exception(const struct type_info *type, const char *file, unsigned line);
 };
 
-extern const struct type type_SystemError;
+extern const struct type_info type_SystemError;
 class SystemError: public Exception {
 public:
 	virtual void raise() { throw this; }
@@ -71,13 +71,13 @@ class SystemError: public Exception {
 	SystemError(const char *file, unsigned line,
 		    const char *format, ...);
 protected:
-	SystemError(const struct type *type, const char *file, unsigned line);
+	SystemError(const struct type_info *type, const char *file, unsigned line);
 protected:
 	/* system errno */
 	int m_errno;
 };
 
-extern const struct type type_OutOfMemory;
+extern const struct type_info type_OutOfMemory;
 class OutOfMemory: public SystemError {
 public:
 	OutOfMemory(const char *file, unsigned line,
@@ -86,21 +86,21 @@ class OutOfMemory: public SystemError {
 	virtual void raise() { throw this; }
 };
 
-extern const struct type type_TimedOut;
+extern const struct type_info type_TimedOut;
 class TimedOut: public SystemError {
 public:
 	TimedOut(const char *file, unsigned line);
 	virtual void raise() { throw this; }
 };
 
-extern const struct type type_ChannelIsClosed;
+extern const struct type_info type_ChannelIsClosed;
 class ChannelIsClosed: public Exception {
 public:
 	ChannelIsClosed(const char *file, unsigned line);
 	virtual void raise() { throw this; }
 };
 
-extern const struct type type_FiberIsCancelled;
+extern const struct type_info type_FiberIsCancelled;
 /**
  * This is thrown by fiber_* API calls when the fiber is
  * cancelled.
@@ -112,7 +112,7 @@ class FiberIsCancelled: public Exception {
 	virtual void raise() { throw this; }
 };
 
-extern const struct type type_LuajitError;
+extern const struct type_info type_LuajitError;
 
 class LuajitError: public Exception {
 public:
@@ -139,8 +139,8 @@ exception_init();
 } while (0)
 
 extern "C" const char *
-exception_get_string(struct error *e, const struct method *method);
+exception_get_string(struct error *e, const struct method_info *method);
 extern "C" int
-exception_get_int(struct error *e, const struct method *method);
+exception_get_int(struct error *e, const struct method_info *method);
 
 #endif /* TARANTOOL_EXCEPTION_H_INCLUDED */
diff --git a/src/lua/init.lua b/src/lua/init.lua
index 9644bc3979..96564b64e8 100644
--- a/src/lua/init.lua
+++ b/src/lua/init.lua
@@ -2,8 +2,8 @@
 
 local ffi = require('ffi')
 ffi.cdef[[
-struct type;
-struct method;
+struct type_info;
+struct method_info;
 struct error;
 
 enum ctype {
@@ -12,10 +12,10 @@ enum ctype {
     CTYPE_CONST_CHAR_PTR
 };
 
-struct type {
+struct type_info {
     const char *name;
-    const struct type *parent;
-    const struct method *methods;
+    const struct type_info *parent;
+    const struct method_info *methods;
 };
 
 enum {
@@ -29,7 +29,7 @@ struct error {
     error_f _destroy;
     error_f _raise;
     error_f _log;
-    const struct type *_type;
+    const struct type_info *_type;
     int _refs;
     /** Line number. */
     unsigned _line;
@@ -41,8 +41,8 @@ struct error {
 
 enum { METHOD_ARG_MAX = 8 };
 
-struct method {
-    const struct type *owner;
+struct method_info {
+    const struct type_info *owner;
     const char *name;
     enum ctype rtype;
     enum ctype atype[METHOD_ARG_MAX];
@@ -56,9 +56,9 @@ struct method {
 };
 
 char *
-exception_get_string(struct error *e, const struct method *method);
+exception_get_string(struct error *e, const struct method_info *method);
 int
-exception_get_int(struct error *e, const struct method *method);
+exception_get_int(struct error *e, const struct method_info *method);
 
 double
 tarantool_uptime(void);
diff --git a/src/reflection.c b/src/reflection.c
index 5ac80db80d..e5fe133a3e 100644
--- a/src/reflection.c
+++ b/src/reflection.c
@@ -32,7 +32,7 @@
 #include "reflection.h"
 /* TODO: sorry, unimplemented: non-trivial designated initializers */
 
-const struct method METHODS_SENTINEL = {
+const struct method_info METHODS_SENTINEL = {
 	.owner = NULL,
 	.name = NULL,
 	.rtype = CTYPE_VOID,
@@ -43,7 +43,7 @@ const struct method METHODS_SENTINEL = {
 };
 
 extern inline bool
-type_assignable(const struct type *type, const struct type *object);
+type_assignable(const struct type_info *type, const struct type_info *object);
 
-extern inline const struct method *
-type_method_by_name(const struct type *type, const char *name);
+extern inline const struct method_info *
+type_method_by_name(const struct type_info *type, const char *name);
diff --git a/src/reflection.h b/src/reflection.h
index ae83c47467..40818c13fe 100644
--- a/src/reflection.h
+++ b/src/reflection.h
@@ -40,8 +40,8 @@
 extern "C" {
 #endif /* defined(__cplusplus) */
 
-struct type;
-struct method;
+struct type_info;
+struct method_info;
 
 /**
  * Primitive C types
@@ -52,14 +52,14 @@ enum ctype {
 	CTYPE_CONST_CHAR_PTR
 };
 
-struct type {
+struct type_info {
 	const char *name;
-	const struct type *parent;
-	const struct method *methods;
+	const struct type_info *parent;
+	const struct method_info *methods;
 };
 
 inline bool
-type_assignable(const struct type *type, const struct type *object)
+type_assignable(const struct type_info *type, const struct type_info *object)
 {
 	assert(object != NULL);
 	do {
@@ -84,13 +84,13 @@ type_assignable(const struct type *type, const struct type *object)
 
 #if defined(__cplusplus)
 /* Pointer to arbitrary C++ member function */
-typedef void (type::*method_thiscall_f)(void);
+typedef void (type_info::*method_thiscall_f)(void);
 #endif
 
 enum { METHOD_ARG_MAX = 8 };
 
-struct method {
-	const struct type *owner;
+struct method_info {
+	const struct type_info *owner;
 	const char *name;
 	enum ctype rtype;
 	enum ctype atype[METHOD_ARG_MAX];
@@ -107,12 +107,12 @@ struct method {
 };
 
 #define type_foreach_method(m, method)					\
-	for(const struct type *_m = (m); _m != NULL; _m = _m->parent)	\
-		for (const struct method *(method) = _m->methods;	\
+	for(const struct type_info *_m = (m); _m != NULL; _m = _m->parent)	\
+		for (const struct method_info *(method) = _m->methods;	\
 		     (method)->name != NULL; (method)++)
 
-inline const struct method *
-type_method_by_name(const struct type *type, const char *name)
+inline const struct method_info *
+type_method_by_name(const struct type_info *type, const char *name)
 {
 	type_foreach_method(type, method) {
 		if (strcmp(method->name, name) == 0)
@@ -121,26 +121,26 @@ type_method_by_name(const struct type *type, const char *name)
 	return NULL;
 }
 
-extern const struct method METHODS_SENTINEL;
+extern const struct method_info METHODS_SENTINEL;
 
 #if defined(__cplusplus)
 } /* extern "C" */
 
-static_assert(sizeof(((struct method *) 0)->thiscall) <=
-	      sizeof(((struct method *) 0)->_spacer), "sizeof(thiscall)");
+static_assert(sizeof(((struct method_info *) 0)->thiscall) <=
+	      sizeof(((struct method_info *) 0)->_spacer), "sizeof(thiscall)");
 
 /*
  * Begin of C++ syntax sugar
  */
 
 /*
- * Initializer for struct type without methods
+ * Initializer for struct type_info without methods
  */
-inline type
-make_type(const char *name, const type *parent)
+inline struct type_info
+make_type(const char *name, const struct type_info *parent)
 {
 	/* TODO: sorry, unimplemented: non-trivial designated initializers */
-	type t;
+	struct type_info t;
 	t.name = name;
 	t.parent = parent;
 	t.methods = &METHODS_SENTINEL;
@@ -148,13 +148,14 @@ make_type(const char *name, const type *parent)
 }
 
 /*
- * Initializer for struct type with methods
+ * Initializer for struct type_info with methods
  */
-inline struct type
-make_type(const char *name, const type *parent, const method *methods)
+inline struct type_info
+make_type(const char *name, const struct type_info *parent,
+	  const struct method_info *methods)
 {
 	/* TODO: sorry, unimplemented: non-trivial designated initializers */
-	type t;
+	struct type_info t;
 	t.name = name;
 	t.parent = parent;
 	t.methods = methods;
@@ -177,7 +178,7 @@ struct method_helper;
 template <int N, typename A, typename... Args>
 struct method_helper<N, A, Args... >  {
 	static bool
-	invokable(const method *method)
+	invokable(const struct method_info *method)
 	{
 		if (method->atype[N] != ctypeof<A>())
 			return false;
@@ -185,7 +186,7 @@ struct method_helper<N, A, Args... >  {
 	}
 
 	static void
-	init(struct method *method)
+	init(struct method_info *method)
 	{
 		method->atype[N] = ctypeof<A>();
 		return method_helper<N + 1, Args... >::init(method);
@@ -195,13 +196,13 @@ struct method_helper<N, A, Args... >  {
 template <int N>
 struct method_helper<N> {
 	static bool
-	invokable(const method *)
+	invokable(const struct method_info *)
 	{
 		return true;
 	}
 
 	static void
-	init(struct method *method)
+	init(struct method_info *method)
 	{
 		method->nargs = N;
 	}
@@ -214,11 +215,11 @@ struct method_helper<N> {
 /**
  * Initializer for R (T::*)(void) C++ member methods
  */
-template<typename R, typename... Args, typename T> inline method
-make_method(const struct type *owner, const char *name,
+template<typename R, typename... Args, typename T> inline struct method_info
+make_method(const struct type_info *owner, const char *name,
 	R (T::*method_arg)(Args...))
 {
-	struct method m;
+	struct method_info m;
 	m.owner = owner;
 	m.name = name;
 	m.thiscall = (method_thiscall_f) method_arg;
@@ -229,11 +230,11 @@ make_method(const struct type *owner, const char *name,
 	return m;
 }
 
-template<typename R, typename... Args, typename T> inline method
-make_method(const struct type *owner, const char *name,
+template<typename R, typename... Args, typename T> inline struct method_info
+make_method(const struct type_info *owner, const char *name,
 	R (T::*method_arg)(Args...) const)
 {
-	struct method m = make_method(owner, name, (R (T::*)(Args...)) method_arg);
+	struct method_info m = make_method(owner, name, (R (T::*)(Args...)) method_arg);
 	m.isconst = true;
 	return m;
 }
@@ -242,7 +243,7 @@ make_method(const struct type *owner, const char *name,
  * Check if method is invokable with provided argument types
  */
 template<typename R, typename... Args, typename T> inline bool
-method_invokable(const struct method *method, T *object)
+method_invokable(const struct method_info *method, T *object)
 {
 	static_assert(sizeof...(Args) <= METHOD_ARG_MAX, "too many arguments");
 	if (!type_assignable(method->owner, object->type))
@@ -255,7 +256,7 @@ method_invokable(const struct method *method, T *object)
 }
 
 template<typename R, typename... Args, typename T> inline bool
-method_invokable(const struct method *method, const T *object)
+method_invokable(const struct method_info *method, const T *object)
 {
 	if (!method->isconst)
 		return false;
@@ -266,7 +267,7 @@ method_invokable(const struct method *method, const T *object)
  * Invoke method with object and provided arguments.
  */
 template<typename R, typename... Args, typename T > inline R
-method_invoke(const struct method *method, T *object, Args... args)
+method_invoke(const struct method_info *method, T *object, Args... args)
 {
 	assert((method_invokable<R, Args...>(method, object)));
 	typedef R (T::*MemberFunction)(Args...);
diff --git a/src/sio.cc b/src/sio.cc
index 64c384dbc7..c906a97a82 100644
--- a/src/sio.cc
+++ b/src/sio.cc
@@ -48,8 +48,8 @@
 #include "say.h"
 #include "trivia/util.h"
 
-const struct type type_SocketError = make_type("SocketError",
-	&type_SystemError);
+const struct type_info type_SocketError =
+	make_type("SocketError", &type_SystemError);
 SocketError::SocketError(const char *file, unsigned line, int fd,
 			 const char *format, ...)
 	: SystemError(&type_SocketError, file, line)
diff --git a/src/sio.h b/src/sio.h
index e5ebe2e704..f234702ec1 100644
--- a/src/sio.h
+++ b/src/sio.h
@@ -93,7 +93,7 @@ sio_add_to_iov(struct iovec *iov, size_t size)
 #include "exception.h"
 enum { SERVICE_NAME_MAXLEN = 32 };
 
-extern const struct type type_SocketError;
+extern const struct type_info type_SocketError;
 class SocketError: public SystemError {
 public:
 	SocketError(const char *file, unsigned line, int fd,
diff --git a/test/unit/reflection_c.c b/test/unit/reflection_c.c
index e35258a683..289099628e 100644
--- a/test/unit/reflection_c.c
+++ b/test/unit/reflection_c.c
@@ -2,17 +2,17 @@
 
 #include "unit.h"
 
-static struct type type_Object = {
+static struct type_info type_Object = {
 	.parent = NULL,
 	.name = "Object",
 	.methods = NULL,
 };
-static struct type type_Database = {
+static struct type_info type_Database = {
 	.parent = &type_Object,
 	.name = "Database",
 	.methods = NULL,
 };
-static struct type type_Tarantool = {
+static struct type_info type_Tarantool = {
 	.parent = &type_Database,
 	.name = "Tarantool",
 	.methods = NULL
diff --git a/test/unit/reflection_cxx.cc b/test/unit/reflection_cxx.cc
index e6a5f731f4..7eaff2a7e4 100644
--- a/test/unit/reflection_cxx.cc
+++ b/test/unit/reflection_cxx.cc
@@ -3,7 +3,7 @@
 #include <string.h>
 #include "reflection.h"
 
-extern const struct type type_Object;
+extern const struct type_info type_Object;
 struct Object {
 	Object()
 		: type(&type_Object)
@@ -12,14 +12,14 @@ struct Object {
 	virtual ~Object()
 	{}
 
-	const struct type *type;
-	Object(const struct type *type_arg)
+	const struct type_info *type;
+	Object(const struct type_info *type_arg)
 		: type(type_arg)
 	{}
 };
-const struct type type_Object = make_type("Object", NULL);
+const struct type_info type_Object = make_type("Object", NULL);
 
-extern const struct type type_Database;
+extern const struct type_info type_Database;
 struct Database: public Object {
 	Database()
 		: Object(&type_Database),
@@ -50,23 +50,23 @@ struct Database: public Object {
 		m_int = val;
 	}
 protected:
-	Database(const struct type *type)
+	Database(const struct type_info *type)
 		: Object(type)
 	{}
 	int m_int;
 	char m_str[128];
 };
-static const struct method database_methods[] = {
+static const struct method_info database_methods[] = {
 	make_method(&type_Database, "getString", &Database::getString),
 	make_method(&type_Database, "getInt", &Database::getInt),
 	make_method(&type_Database, "putString", &Database::putString),
 	make_method(&type_Database, "putInt", &Database::putInt),
 	METHODS_SENTINEL
 };
-const struct type type_Database = make_type("Database", &type_Object,
+const struct type_info type_Database = make_type("Database", &type_Object,
 	database_methods);
 
-extern const struct type type_Tarantool;
+extern const struct type_info type_Tarantool;
 struct Tarantool: public Database {
 	Tarantool()
 		: Database(&type_Tarantool)
@@ -76,11 +76,11 @@ struct Tarantool: public Database {
 		++m_int;
 	}
 };
-static const struct method tarantool_methods[] = {
+static const struct method_info tarantool_methods[] = {
 	make_method(&type_Tarantool, "inc", &Tarantool::inc),
 	METHODS_SENTINEL
 };
-const struct type type_Tarantool = make_type("Tarantool", &type_Database,
+const struct type_info type_Tarantool = make_type("Tarantool", &type_Database,
 	tarantool_methods);
 
 int
@@ -90,18 +90,18 @@ main()
 
 	Object obj;
 	Tarantool tntobj;
-	const struct method *get_string = type_method_by_name(tntobj.type,
+	const struct method_info *get_string = type_method_by_name(tntobj.type,
 		"getString");
-	const struct method *put_string = type_method_by_name(tntobj.type,
+	const struct method_info *put_string = type_method_by_name(tntobj.type,
 		"putString");
-	const struct method *get_int = type_method_by_name(tntobj.type,
+	const struct method_info *get_int = type_method_by_name(tntobj.type,
 		"getInt");
-	const struct method *put_int = type_method_by_name(tntobj.type,
+	const struct method_info *put_int = type_method_by_name(tntobj.type,
 		"putInt");
-	const struct method *inc = type_method_by_name(tntobj.type,
+	const struct method_info *inc = type_method_by_name(tntobj.type,
 		"inc");
 
-	/* struct type members */
+	/* struct type_info members */
 	ok(strcmp(type_Object.name, "Object") == 0, "type.name");
 	is(type_Object.parent, NULL, "type.parent");
 	is(type_Database.parent, &type_Object, "type.parent");
@@ -128,7 +128,7 @@ main()
 
 
 	/*
-	 * struct method members
+	 * struct method_info members
 	 */
 	is(get_string->owner, &type_Database, "method.owner");
 	ok(strcmp(get_string->name, "getString") == 0, "method.name");
-- 
GitLab