You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/09/08 10:13:38 UTC
(nuttx) branch master updated: libs/libc/queue: inline queue list to improve performance add a config CONFIG_LIBC_INLINE_QUEUE to inline the queue list
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 41e976d119 libs/libc/queue: inline queue list to improve performance add a config CONFIG_LIBC_INLINE_QUEUE to inline the queue list
41e976d119 is described below
commit 41e976d11992c1f965fe8bfa7296b716f63e9544
Author: hujun5 <hu...@xiaomi.com>
AuthorDate: Fri Jul 19 11:13:38 2024 +0800
libs/libc/queue: inline queue list to improve performance
add a config CONFIG_LIBC_INLINE_QUEUE to inline the queue list
test:
We can use qemu for testing.
compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
Signed-off-by: hujun5 <hu...@xiaomi.com>
---
include/nuttx/queue.h | 225 ++++++++++++++++++++++++++++++++
libs/libc/Kconfig | 1 +
libs/libc/queue/CMakeLists.txt | 13 +-
libs/libc/queue/Kconfig | 10 ++
libs/libc/queue/Make.defs | 3 +-
libs/libc/queue/dq_addafter.c | 54 --------
libs/libc/queue/dq_count.c | 54 --------
libs/libc/queue/dq_remafter.c | 50 -------
libs/libc/queue/dq_remfirst.c | 62 ---------
libs/libc/queue/dq_remlast.c | 62 ---------
libs/libc/queue/{sq_count.c => queue.c} | 34 ++---
libs/libc/queue/sq_addafter.c | 51 --------
libs/libc/queue/sq_remafter.c | 60 ---------
libs/libc/queue/sq_remfirst.c | 55 --------
libs/libc/queue/sq_remlast.c | 68 ----------
15 files changed, 251 insertions(+), 551 deletions(-)
diff --git a/include/nuttx/queue.h b/include/nuttx/queue.h
index 6a07d6a4dc..04bda577ee 100644
--- a/include/nuttx/queue.h
+++ b/include/nuttx/queue.h
@@ -31,6 +31,14 @@
* Pre-processor Definitions
****************************************************************************/
+#ifdef CONFIG_LIBC_INLINE_QUEUE
+# ifndef STATIC_INLINE
+# define STATIC_INLINE static inline_function
+# endif
+#else
+# define STATIC_INLINE
+#endif
+
#define sq_init(q) \
do \
{ \
@@ -343,24 +351,241 @@ extern "C"
/* Add nodes to queues */
+#ifndef CONFIG_LIBC_INLINE_QUEUE
void sq_addafter(FAR sq_entry_t *prev, FAR sq_entry_t *node,
FAR sq_queue_t *queue);
+#else
+STATIC_INLINE void sq_addafter(FAR sq_entry_t *prev, FAR sq_entry_t *node,
+ FAR sq_queue_t *queue)
+{
+ if (!queue->head || prev == queue->tail)
+ {
+ sq_addlast(node, queue);
+ }
+ else
+ {
+ node->flink = prev->flink;
+ prev->flink = node;
+ }
+}
+#endif
+
+#ifndef CONFIG_LIBC_INLINE_QUEUE
void dq_addafter(FAR dq_entry_t *prev, FAR dq_entry_t *node,
FAR dq_queue_t *queue);
+#else
+STATIC_INLINE void dq_addafter(FAR dq_entry_t *prev, FAR dq_entry_t *node,
+ FAR dq_queue_t *queue)
+{
+ if (!queue->head || prev == queue->tail)
+ {
+ dq_addlast(node, queue);
+ }
+ else
+ {
+ FAR dq_entry_t *next = prev->flink;
+ node->blink = prev;
+ node->flink = next;
+ next->blink = node;
+ prev->flink = node;
+ }
+}
+#endif
/* Remove nodes from queues */
+#ifndef CONFIG_LIBC_INLINE_QUEUE
FAR sq_entry_t *sq_remafter(FAR sq_entry_t *node, FAR sq_queue_t *queue);
+#else
+STATIC_INLINE FAR sq_entry_t *sq_remafter(FAR sq_entry_t *node,
+ FAR sq_queue_t *queue)
+{
+ FAR sq_entry_t *ret = node->flink;
+
+ if (queue->head && ret)
+ {
+ if (queue->tail == ret)
+ {
+ queue->tail = node;
+ node->flink = NULL;
+ }
+ else
+ {
+ node->flink = ret->flink;
+ }
+
+ ret->flink = NULL;
+ }
+
+ return ret;
+}
+#endif
+
+#ifndef CONFIG_LIBC_INLINE_QUEUE
FAR dq_entry_t *dq_remafter(FAR dq_entry_t *node, FAR dq_queue_t *queue);
+#else
+STATIC_INLINE FAR dq_entry_t *dq_remafter(FAR dq_entry_t *node,
+ FAR dq_queue_t *queue)
+{
+ FAR dq_entry_t *ret = node->flink;
+
+ if (queue->head != NULL && ret != NULL)
+ {
+ dq_rem(ret, queue);
+ }
+
+ return ret;
+}
+#endif
+
+#ifndef CONFIG_LIBC_INLINE_QUEUE
FAR sq_entry_t *sq_remlast(FAR sq_queue_t *queue);
+#else
+STATIC_INLINE FAR sq_entry_t *sq_remlast(FAR sq_queue_t *queue)
+{
+ FAR sq_entry_t *ret = queue->tail;
+
+ if (ret)
+ {
+ if (queue->head == queue->tail)
+ {
+ queue->head = NULL;
+ queue->tail = NULL;
+ }
+ else
+ {
+ FAR sq_entry_t *prev;
+ for (prev = queue->head;
+ prev && prev->flink != ret;
+ prev = prev->flink);
+
+ if (prev)
+ {
+ prev->flink = NULL;
+ queue->tail = prev;
+ }
+ }
+
+ ret->flink = NULL;
+ }
+
+ return ret;
+}
+#endif
+
+#ifndef CONFIG_LIBC_INLINE_QUEUE
FAR dq_entry_t *dq_remlast(FAR dq_queue_t *queue);
+#else
+STATIC_INLINE FAR dq_entry_t *dq_remlast(FAR dq_queue_t *queue)
+{
+ FAR dq_entry_t *ret = queue->tail;
+
+ if (ret)
+ {
+ FAR dq_entry_t *prev = ret->blink;
+ if (!prev)
+ {
+ queue->head = NULL;
+ queue->tail = NULL;
+ }
+ else
+ {
+ queue->tail = prev;
+ prev->flink = NULL;
+ }
+
+ ret->flink = NULL;
+ ret->blink = NULL;
+ }
+
+ return ret;
+}
+#endif
+
+#ifndef CONFIG_LIBC_INLINE_QUEUE
FAR sq_entry_t *sq_remfirst(FAR sq_queue_t *queue);
+#else
+STATIC_INLINE FAR sq_entry_t *sq_remfirst(FAR sq_queue_t *queue)
+{
+ FAR sq_entry_t *ret = queue->head;
+
+ if (ret)
+ {
+ queue->head = ret->flink;
+ if (!queue->head)
+ {
+ queue->tail = NULL;
+ }
+
+ ret->flink = NULL;
+ }
+
+ return ret;
+}
+#endif
+
+#ifndef CONFIG_LIBC_INLINE_QUEUE
FAR dq_entry_t *dq_remfirst(FAR dq_queue_t *queue);
+#else
+STATIC_INLINE FAR dq_entry_t *dq_remfirst(FAR dq_queue_t *queue)
+{
+ FAR dq_entry_t *ret = queue->head;
+
+ if (ret)
+ {
+ FAR dq_entry_t *next = ret->flink;
+ if (!next)
+ {
+ queue->head = NULL;
+ queue->tail = NULL;
+ }
+ else
+ {
+ queue->head = next;
+ next->blink = NULL;
+ }
+
+ ret->flink = NULL;
+ ret->blink = NULL;
+ }
+
+ return ret;
+}
+#endif
/* Count nodes in queues */
+#ifndef CONFIG_LIBC_INLINE_QUEUE
size_t sq_count(FAR sq_queue_t *queue);
+#else
+STATIC_INLINE size_t sq_count(FAR sq_queue_t *queue)
+{
+ FAR sq_entry_t *node;
+ size_t count;
+
+ for (node = queue->head, count = 0;
+ node != NULL;
+ node = node->flink, count++);
+
+ return count;
+}
+#endif
+
+#ifndef CONFIG_LIBC_INLINE_QUEUE
size_t dq_count(FAR dq_queue_t *queue);
+#else
+STATIC_INLINE size_t dq_count(FAR dq_queue_t *queue)
+{
+ FAR dq_entry_t *node;
+ size_t count;
+
+ for (node = queue->head, count = 0;
+ node != NULL;
+ node = node->flink, count++);
+
+ return count;
+}
+#endif
#undef EXTERN
#ifdef __cplusplus
diff --git a/libs/libc/Kconfig b/libs/libc/Kconfig
index 3c15475ead..15e292d706 100644
--- a/libs/libc/Kconfig
+++ b/libs/libc/Kconfig
@@ -33,3 +33,4 @@ source "libs/libc/stream/Kconfig"
source "libs/libc/regex/Kconfig"
source "libs/libc/gpsutils/Kconfig"
source "libs/libc/fdt/Kconfig"
+source "libs/libc/queue/Kconfig"
diff --git a/libs/libc/queue/CMakeLists.txt b/libs/libc/queue/CMakeLists.txt
index 5b9467347b..0f55f6548f 100644
--- a/libs/libc/queue/CMakeLists.txt
+++ b/libs/libc/queue/CMakeLists.txt
@@ -18,15 +18,4 @@
#
# ##############################################################################
-target_sources(
- c
- PRIVATE sq_addafter.c
- sq_remlast.c
- sq_remfirst.c
- sq_remafter.c
- sq_count.c
- dq_addafter.c
- dq_remlast.c
- dq_remfirst.c
- dq_remafter.c
- dq_count.c)
+target_sources(c PRIVATE queue.c)
diff --git a/libs/libc/queue/Kconfig b/libs/libc/queue/Kconfig
new file mode 100644
index 0000000000..677ec9dca9
--- /dev/null
+++ b/libs/libc/queue/Kconfig
@@ -0,0 +1,10 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+config LIBC_INLINE_QUEUE
+ bool "Inline queue list to improve the performance"
+ default !DEFAULT_SMALL
+ ---help---
+ Inline queue list to improve the performance
diff --git a/libs/libc/queue/Make.defs b/libs/libc/queue/Make.defs
index f66b8cc2cd..a3a6ade67d 100644
--- a/libs/libc/queue/Make.defs
+++ b/libs/libc/queue/Make.defs
@@ -20,8 +20,7 @@
# Add the queue C files to the build
-CSRCS += sq_addafter.c sq_remlast.c sq_remfirst.c sq_remafter.c sq_count.c
-CSRCS += dq_addafter.c dq_remlast.c dq_remfirst.c dq_remafter.c dq_count.c
+CSRCS += queue.c
# Add the queue directory to the build
diff --git a/libs/libc/queue/dq_addafter.c b/libs/libc/queue/dq_addafter.c
deleted file mode 100644
index 7cee4d1b2a..0000000000
--- a/libs/libc/queue/dq_addafter.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/dq_addafter.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: dq_addafter
- *
- * Description:
- * dq_addafter function adds 'node' after 'prev' in the 'queue.'
- *
- ****************************************************************************/
-
-void dq_addafter(FAR dq_entry_t *prev, FAR dq_entry_t *node,
- dq_queue_t *queue)
-{
- if (!queue->head || prev == queue->tail)
- {
- dq_addlast(node, queue);
- }
- else
- {
- FAR dq_entry_t *next = prev->flink;
- node->blink = prev;
- node->flink = next;
- next->blink = node;
- prev->flink = node;
- }
-}
diff --git a/libs/libc/queue/dq_count.c b/libs/libc/queue/dq_count.c
deleted file mode 100644
index 5524aa6a63..0000000000
--- a/libs/libc/queue/dq_count.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/dq_count.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <nuttx/queue.h>
-#include <assert.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: dq_count
- *
- * Description:
- * Return the number of nodes in the queue.
- *
- ****************************************************************************/
-
-size_t dq_count(FAR dq_queue_t *queue)
-{
- FAR dq_entry_t *node;
- size_t count;
-
- DEBUGASSERT(queue != NULL);
-
- for (node = queue->head, count = 0;
- node != NULL;
- node = node->flink, count++);
-
- return count;
-}
diff --git a/libs/libc/queue/dq_remafter.c b/libs/libc/queue/dq_remafter.c
deleted file mode 100644
index baa9ed1b5b..0000000000
--- a/libs/libc/queue/dq_remafter.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/dq_remafter.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: dq_remafter
- *
- * Description:
- * dq_remafter removes the entry following 'node' from the 'queue'.
- * Returns a reference to the removed entry.
- *
- ****************************************************************************/
-
-FAR dq_entry_t *dq_remafter(FAR dq_entry_t *node, FAR dq_queue_t *queue)
-{
- FAR dq_entry_t *ret = node->flink;
-
- if (queue->head != NULL && ret != NULL)
- {
- dq_rem(ret, queue);
- }
-
- return ret;
-}
diff --git a/libs/libc/queue/dq_remfirst.c b/libs/libc/queue/dq_remfirst.c
deleted file mode 100644
index da1936894f..0000000000
--- a/libs/libc/queue/dq_remfirst.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/dq_remfirst.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: dq_remfirst
- *
- * Description:
- * dq_remfirst removes 'node' from the head of 'queue'
- *
- ****************************************************************************/
-
-FAR dq_entry_t *dq_remfirst(dq_queue_t *queue)
-{
- FAR dq_entry_t *ret = queue->head;
-
- if (ret)
- {
- FAR dq_entry_t *next = ret->flink;
- if (!next)
- {
- queue->head = NULL;
- queue->tail = NULL;
- }
- else
- {
- queue->head = next;
- next->blink = NULL;
- }
-
- ret->flink = NULL;
- ret->blink = NULL;
- }
-
- return ret;
-}
diff --git a/libs/libc/queue/dq_remlast.c b/libs/libc/queue/dq_remlast.c
deleted file mode 100644
index decaa49fb6..0000000000
--- a/libs/libc/queue/dq_remlast.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/dq_remlast.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/***************************************************(************************
- * Name: dq_remlast
- *
- * Description:
- * dq_remlast removes the last entry from 'queue'
- *
- ****************************************************************************/
-
-FAR dq_entry_t *dq_remlast(dq_queue_t *queue)
-{
- FAR dq_entry_t *ret = queue->tail;
-
- if (ret)
- {
- FAR dq_entry_t *prev = ret->blink;
- if (!prev)
- {
- queue->head = NULL;
- queue->tail = NULL;
- }
- else
- {
- queue->tail = prev;
- prev->flink = NULL;
- }
-
- ret->flink = NULL;
- ret->blink = NULL;
- }
-
- return ret;
-}
diff --git a/libs/libc/queue/sq_count.c b/libs/libc/queue/queue.c
similarity index 79%
rename from libs/libc/queue/sq_count.c
rename to libs/libc/queue/queue.c
index 8ba926be56..e08bd76480 100644
--- a/libs/libc/queue/sq_count.c
+++ b/libs/libc/queue/queue.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * libs/libc/queue/sq_count.c
+ * libs/libc/queue/queue.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -24,31 +24,23 @@
#include <nuttx/config.h>
-#include <nuttx/queue.h>
-#include <assert.h>
-
/****************************************************************************
- * Public Functions
+ * Pre-processor Definitions
****************************************************************************/
+#ifndef CONFIG_LIBC_INLINE_QUEUE
+
+# define CONFIG_LIBC_INLINE_QUEUE
+# define STATIC_INLINE
+
/****************************************************************************
- * Name: sq_count
- *
- * Description:
- * Return the number of nodes in the queue.
- *
+ * Included Files
****************************************************************************/
-size_t sq_count(FAR sq_queue_t *queue)
-{
- FAR sq_entry_t *node;
- size_t count;
-
- DEBUGASSERT(queue != NULL);
+# include <nuttx/queue.h>
- for (node = queue->head, count = 0;
- node != NULL;
- node = node->flink, count++);
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
- return count;
-}
+#endif
diff --git a/libs/libc/queue/sq_addafter.c b/libs/libc/queue/sq_addafter.c
deleted file mode 100644
index 69addca8f0..0000000000
--- a/libs/libc/queue/sq_addafter.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/sq_addafter.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: sq_addafter.c
- *
- * Description:
- * The sq_addafter function adds 'node' after 'prev' in the 'queue.'
- *
- ****************************************************************************/
-
-void sq_addafter(FAR sq_entry_t *prev, FAR sq_entry_t *node,
- sq_queue_t *queue)
-{
- if (!queue->head || prev == queue->tail)
- {
- sq_addlast(node, queue);
- }
- else
- {
- node->flink = prev->flink;
- prev->flink = node;
- }
-}
diff --git a/libs/libc/queue/sq_remafter.c b/libs/libc/queue/sq_remafter.c
deleted file mode 100644
index bd8ae1357c..0000000000
--- a/libs/libc/queue/sq_remafter.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/sq_remafter.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: sq_remafter
- *
- * Description:
- * sq_remafter removes the entry following 'node' from the 'queue'.
- * Returns a reference to the removed entry.
- *
- ****************************************************************************/
-
-FAR sq_entry_t *sq_remafter(FAR sq_entry_t *node, sq_queue_t *queue)
-{
- FAR sq_entry_t *ret = node->flink;
-
- if (queue->head && ret)
- {
- if (queue->tail == ret)
- {
- queue->tail = node;
- node->flink = NULL;
- }
- else
- {
- node->flink = ret->flink;
- }
-
- ret->flink = NULL;
- }
-
- return ret;
-}
diff --git a/libs/libc/queue/sq_remfirst.c b/libs/libc/queue/sq_remfirst.c
deleted file mode 100644
index 893c188dd8..0000000000
--- a/libs/libc/queue/sq_remfirst.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/sq_remfirst.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: sq_remfirst
- *
- * Description:
- * sq_remfirst function removes the first entry from 'queue'
- *
- ****************************************************************************/
-
-FAR sq_entry_t *sq_remfirst(sq_queue_t *queue)
-{
- FAR sq_entry_t *ret = queue->head;
-
- if (ret)
- {
- queue->head = ret->flink;
- if (!queue->head)
- {
- queue->tail = NULL;
- }
-
- ret->flink = NULL;
- }
-
- return ret;
-}
diff --git a/libs/libc/queue/sq_remlast.c b/libs/libc/queue/sq_remlast.c
deleted file mode 100644
index f136143bb3..0000000000
--- a/libs/libc/queue/sq_remlast.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/sq_remlast.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: sq_remlast
- *
- * Description:
- * Removes the last entry in a singly-linked queue.
- *
- ****************************************************************************/
-
-FAR sq_entry_t *sq_remlast(sq_queue_t *queue)
-{
- FAR sq_entry_t *ret = queue->tail;
-
- if (ret)
- {
- if (queue->head == queue->tail)
- {
- queue->head = NULL;
- queue->tail = NULL;
- }
- else
- {
- FAR sq_entry_t *prev;
- for (prev = queue->head;
- prev && prev->flink != ret;
- prev = prev->flink);
-
- if (prev)
- {
- prev->flink = NULL;
- queue->tail = prev;
- }
- }
-
- ret->flink = NULL;
- }
-
- return ret;
-}