kconfig: split list_head into a separate header
authorMasahiro Yamada <masahiroy@kernel.org>
Fri, 2 Feb 2024 15:58:17 +0000 (00:58 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Mon, 19 Feb 2024 09:20:41 +0000 (18:20 +0900)
The struct list_head is often embedded in other structures, while other
code is used in C functions.

By separating struct list_head into its own header, other headers are no
longer required to include the entire list.h.

This is similar to the kernel space, where struct list_head is defined
in <linux/types.h> instead of <linux/list.h>.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/kconfig/expr.h
scripts/kconfig/list.h
scripts/kconfig/list_types.h [new file with mode: 0644]
scripts/kconfig/mconf.c
scripts/kconfig/menu.c
scripts/kconfig/nconf.c

index d667f9aa041e7a0adf6ecd4875d8d7ecb140e0ac..dd3350aed302c304ed226425e49ec3645c7e59d5 100644 (file)
@@ -12,7 +12,7 @@ extern "C" {
 
 #include <assert.h>
 #include <stdio.h>
-#include "list.h"
+#include "list_types.h"
 #ifndef __cplusplus
 #include <stdbool.h>
 #endif
index 45cb237ab7ef7a9f17779647220da6a30afd06fc..babed0baf4ae8bb171785752cc49c90bbc569173 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef LIST_H
 #define LIST_H
 
+#include "list_types.h"
+
 /*
  * Copied from include/linux/...
  */
        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
        (type *)( (char *)__mptr - offsetof(type,member) );})
 
-
-struct list_head {
-       struct list_head *next, *prev;
-};
-
-
 #define LIST_HEAD_INIT(name) { &(name), &(name) }
 
 #define LIST_HEAD(name) \
diff --git a/scripts/kconfig/list_types.h b/scripts/kconfig/list_types.h
new file mode 100644 (file)
index 0000000..32899f4
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef LIST_TYPES_H
+#define LIST_TYPES_H
+
+struct list_head {
+       struct list_head *next, *prev;
+};
+
+#endif /* LIST_TYPES_H */
index 5df32148a86951f78dca309db7d06d77f2364259..f4bb391d50cf997c0a66ca3e54ceb062f6cea54e 100644 (file)
@@ -19,6 +19,7 @@
 #include <signal.h>
 #include <unistd.h>
 
+#include "list.h"
 #include "lkc.h"
 #include "lxdialog/dialog.h"
 #include "mnconf-common.h"
index f701382f8a6929196612ac7149d7c7167f23997e..696803d944e0106b617a297fe84504a9c5e49ba9 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "lkc.h"
 #include "internal.h"
+#include "list.h"
 
 static const char nohelp_text[] = "There is no help available for this option.";
 
index 1148163cfa7e71c037ba28eab8183cf304fc5b85..9d22b0f3197b8740c29d10af7de341c7b1d1c14c 100644 (file)
@@ -11,6 +11,7 @@
 #include <strings.h>
 #include <stdlib.h>
 
+#include "list.h"
 #include "lkc.h"
 #include "mnconf-common.h"
 #include "nconf.h"