[前][次][番号順一覧][スレッド一覧]

ruby-changes:71552

From: Nobuyoshi <ko1@a...>
Date: Wed, 30 Mar 2022 16:36:55 +0900 (JST)
Subject: [ruby-changes:71552] 42a0bed351 (master): Prefix ccan headers (#4568)

https://git.ruby-lang.org/ruby.git/commit/?id=42a0bed351

From 42a0bed351979cb4a59c641fa5f03e49609561fd Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 30 Mar 2022 16:36:31 +0900
Subject: Prefix ccan headers (#4568)

* Prefixed ccan headers

* Remove unprefixed names in ccan/build_assert

* Remove unprefixed names in ccan/check_type

* Remove unprefixed names in ccan/container_of

* Remove unprefixed names in ccan/list

Co-authored-by: Samuel Williams <samuel.williams@o...>
---
 ccan/build_assert/build_assert.h |  12 +-
 ccan/check_type/check_type.h     |  26 +-
 ccan/container_of/container_of.h |  48 ++--
 ccan/list/list.h                 | 585 ++++++++++++++++++++-------------------
 ccan/str/str.h                   |   9 +-
 gc.c                             |  58 ++--
 io.c                             |  10 +-
 mjit.c                           |  14 +-
 mjit_worker.c                    |  36 +--
 process.c                        |  38 +--
 ractor.c                         |  18 +-
 ractor_core.h                    |   4 +-
 thread.c                         |  50 ++--
 thread_pthread.c                 |  50 ++--
 thread_pthread.h                 |   6 +-
 thread_sync.c                    |  76 ++---
 variable.c                       |  32 +--
 vm.c                             |  14 +-
 vm_core.h                        |  22 +-
 vm_dump.c                        |   2 +-
 vm_sync.c                        |   4 +-
 vm_trace.c                       |  20 +-
 22 files changed, 568 insertions(+), 566 deletions(-)

diff --git a/ccan/build_assert/build_assert.h b/ccan/build_assert/build_assert.h
index a04d1d4709..b846849241 100644
--- a/ccan/build_assert/build_assert.h
+++ b/ccan/build_assert/build_assert.h
@@ -3,7 +3,7 @@ https://github.com/ruby/ruby/blob/trunk/ccan/build_assert/build_assert.h#L3
 #define CCAN_BUILD_ASSERT_H
 
 /**
- * BUILD_ASSERT - assert a build-time dependency.
+ * CCAN_BUILD_ASSERT - assert a build-time dependency.
  * @cond: the compile-time condition which must be true.
  *
  * Your compile will fail if the condition isn't true, or can't be evaluated
@@ -15,15 +15,15 @@ https://github.com/ruby/ruby/blob/trunk/ccan/build_assert/build_assert.h#L15
  *	static char *foo_to_char(struct foo *foo)
  *	{
  *		// This code needs string to be at start of foo.
- *		BUILD_ASSERT(offsetof(struct foo, string) == 0);
+ *		CCAN_BUILD_ASSERT(offsetof(struct foo, string) == 0);
  *		return (char *)foo;
  *	}
  */
-#define BUILD_ASSERT(cond) \
+#define CCAN_BUILD_ASSERT(cond) \
 	do { (void) sizeof(char [1 - 2*!(cond)]); } while(0)
 
 /**
- * BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression.
+ * CCAN_BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression.
  * @cond: the compile-time condition which must be true.
  *
  * Your compile will fail if the condition isn't true, or can't be evaluated
@@ -32,9 +32,9 @@ https://github.com/ruby/ruby/blob/trunk/ccan/build_assert/build_assert.h#L32
  * Example:
  *	#define foo_to_char(foo)					\
  *		 ((char *)(foo)						\
- *		  + BUILD_ASSERT_OR_ZERO(offsetof(struct foo, string) == 0))
+ *		  + CCAN_BUILD_ASSERT_OR_ZERO(offsetof(struct foo, string) == 0))
  */
-#define BUILD_ASSERT_OR_ZERO(cond) \
+#define CCAN_BUILD_ASSERT_OR_ZERO(cond) \
 	(sizeof(char [1 - 2*!(cond)]) - 1)
 
 #endif /* CCAN_BUILD_ASSERT_H */
diff --git a/ccan/check_type/check_type.h b/ccan/check_type/check_type.h
index 1f77a535e4..e795ad71d0 100644
--- a/ccan/check_type/check_type.h
+++ b/ccan/check_type/check_type.h
@@ -3,7 +3,7 @@ https://github.com/ruby/ruby/blob/trunk/ccan/check_type/check_type.h#L3
 #define CCAN_CHECK_TYPE_H
 
 /**
- * check_type - issue a warning or build failure if type is not correct.
+ * ccan_check_type - issue a warning or build failure if type is not correct.
  * @expr: the expression whose type we should check (not evaluated).
  * @type: the exact type we expect the expression to be.
  *
@@ -11,7 +11,7 @@ https://github.com/ruby/ruby/blob/trunk/ccan/check_type/check_type.h#L11
  * argument is of the expected type.  No type promotion of the expression is
  * done: an unsigned int is not the same as an int!
  *
- * check_type() always evaluates to 0.
+ * ccan_check_type() always evaluates to 0.
  *
  * If your compiler does not support typeof, then the best we can do is fail
  * to compile if the sizes of the types are unequal (a less complete check).
@@ -19,11 +19,11 @@ https://github.com/ruby/ruby/blob/trunk/ccan/check_type/check_type.h#L19
  * Example:
  *	// They should always pass a 64-bit value to _set_some_value!
  *	#define set_some_value(expr)			\
- *		_set_some_value((check_type((expr), uint64_t), (expr)))
+ *		_set_some_value((ccan_check_type((expr), uint64_t), (expr)))
  */
 
 /**
- * check_types_match - issue a warning or build failure if types are not same.
+ * ccan_check_types_match - issue a warning or build failure if types are not same.
  * @expr1: the first expression (not evaluated).
  * @expr2: the second expression (not evaluated).
  *
@@ -31,7 +31,7 @@ https://github.com/ruby/ruby/blob/trunk/ccan/check_type/check_type.h#L31
  * arguments are of identical types.  No type promotion of the expressions is
  * done: an unsigned int is not the same as an int!
  *
- * check_types_match() always evaluates to 0.
+ * ccan_check_types_match() always evaluates to 0.
  *
  * If your compiler does not support typeof, then the best we can do is fail
  * to compile if the sizes of the types are unequal (a less complete check).
@@ -39,25 +39,25 @@ https://github.com/ruby/ruby/blob/trunk/ccan/check_type/check_type.h#L39
  * Example:
  *	// Do subtraction to get to enclosing type, but make sure that
  *	// pointer is of correct type for that member.
- *	#define container_of(mbr_ptr, encl_type, mbr)			\
- *		(check_types_match((mbr_ptr), &((encl_type *)0)->mbr),	\
+ *	#define ccan_container_of(mbr_ptr, encl_type, mbr)			\
+ *		(ccan_check_types_match((mbr_ptr), &((encl_type *)0)->mbr),	\
  *		 ((encl_type *)						\
  *		  ((char *)(mbr_ptr) - offsetof(enclosing_type, mbr))))
  */
 #if HAVE_TYPEOF
-#define check_type(expr, type)			\
+#define ccan_check_type(expr, type)			\
 	((typeof(expr) *)0 != (type *)0)
 
-#define check_types_match(expr1, expr2)		\
+#define ccan_check_types_match(expr1, expr2)		\
 	((typeof(expr1) *)0 != (typeof(expr2) *)0)
 #else
 #include "ccan/build_assert/build_assert.h"
 /* Without typeof, we can only test the sizes. */
-#define check_type(expr, type)					\
-	BUILD_ASSERT_OR_ZERO(sizeof(expr) == sizeof(type))
+#define ccan_check_type(expr, type)					\
+	CCAN_BUILD_ASSERT_OR_ZERO(sizeof(expr) == sizeof(type))
 
-#define check_types_match(expr1, expr2)				\
-	BUILD_ASSERT_OR_ZERO(sizeof(expr1) == sizeof(expr2))
+#define ccan_check_types_match(expr1, expr2)				\
+	CCAN_BUILD_ASSERT_OR_ZERO(sizeof(expr1) == sizeof(expr2))
 #endif /* HAVE_TYPEOF */
 
 #endif /* CCAN_CHECK_TYPE_H */
diff --git a/ccan/container_of/container_of.h b/ccan/container_of/container_of.h
index ae3e1fc81f..b30c347d57 100644
--- a/ccan/container_of/container_of.h
+++ b/ccan/container_of/container_of.h
@@ -4,7 +4,7 @@ https://github.com/ruby/ruby/blob/trunk/ccan/container_of/container_of.h#L4
 #include "ccan/check_type/check_type.h"
 
 /**
- * container_of - get pointer to enclosing structure
+ * ccan_container_of - get pointer to enclosing structure
  * @member_ptr: pointer to the structure member
  * @containing_type: the type this member is within
  * @member: the name of this member within the structure.
@@ -24,18 +24,18 @@ https://github.com/ruby/ruby/blob/trunk/ccan/container_of/container_of.h#L24
  *
  *	static struct info *foo_to_info(struct foo *foo)
  *	{
- *		return container_of(foo, struct info, my_foo);
+ *		return ccan_container_of(foo, struct info, my_foo);
  *	}
  */
-#define container_of(member_ptr, containing_type, member)		\
+#define ccan_container_of(member_ptr, containing_type, member)		\
 	 ((containing_type *)						\
 	  ((char *)(member_ptr)						\
-	   - container_off(containing_type, member))			\
-	  + check_types_match(*(member_ptr), ((containing_type *)0)->member))
+	   - ccan_container_off(containing_type, member))		\
+	  + ccan_check_types_match(*(member_ptr), ((containing_type *)0)->member))
 
 
 /**
- * container_of_or_null - get pointer to enclosing structure, or NULL
+ * ccan_container_of_or_null - get pointer to enclosing structure, or NULL
  * @member_ptr: pointer to the structure member
  * @containing_type: the type this member is within
  * @member: the name of this member within the structure.
@@ -56,21 +56,21 @@ https://github.com/ruby/ruby/blob/trunk/ccan/container_of/container_of.h#L56
  *
  *	static struct info *foo_to_info_allowing_null(struct foo *foo)
  *	{
- *		return container_of_or_null(foo, struct info, my_foo);
+ *		return ccan_container_of_or_null(foo, struct info, my_foo);
  *	}
  */
 static inline char *container_of_or_null_(void *member_ptr, size_t offset)
 {
 	return member_ptr ? (char *)member_ptr - offset : NULL;
 }
-#define container_of_or_null(member_ptr, containing_type, member)	\
+#define ccan_container_of_or_null(member_ptr, containing_type, member)	\
 	((containing_type *)						\
-	 container_of_or_null_(member_ptr,				\
-			       container_off(containing_type, member))	\
-	 + check_types_match(*(member_ptr), ((containing_type *)0)->member))
+	 ccan_container_of_or_null_(member_ptr,				\
+			       ccan_container_off(containing_type, member))	\
+	 + ccan_check_types_match(*(member_ptr), ((containing_type *)0)->member))
 
 /**
- * container_off - get offset to enclosing structure
+ * ccan_container_off - get offset to enclosing structure
  * @containing_type: the type this member is within
  * @member: the name of this member within the structure.
  *
@@ -89,15 +89,15 @@ static inline char *container_of_or_null_(void *member_ptr, size_t offset) https://github.com/ruby/ruby/blob/trunk/ccan/container_of/container_of.h#L89
  *
  *	static struct info *foo_to_info(struct foo *foo)
  *	{
- *		s (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]