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 2022/09/04 03:08:07 UTC

[incubator-nuttx] branch master updated: nuttx/queue: change some queue function to macro

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/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a9252aec9 nuttx/queue: change some queue function to macro
1a9252aec9 is described below

commit 1a9252aec98319531d7c910595053461a386df25
Author: zhangyuan21 <zh...@xiaomi.com>
AuthorDate: Wed Aug 31 12:56:44 2022 +0800

    nuttx/queue: change some queue function to macro
---
 drivers/audio/cxd56.h          |   6 +-
 include/queue.h                | 193 ++++++++++++++++++++++++++++++++++++++---
 libs/libc/libc.csv             |   7 --
 libs/libc/queue/Make.defs      |   6 +-
 libs/libc/queue/dq_addbefore.c |  54 ------------
 libs/libc/queue/dq_addfirst.c  |  54 ------------
 libs/libc/queue/dq_addlast.c   |  54 ------------
 libs/libc/queue/dq_cat.c       |  65 --------------
 libs/libc/queue/dq_rem.c       |  64 --------------
 libs/libc/queue/sq_addfirst.c  |  48 ----------
 libs/libc/queue/sq_addlast.c   |  52 -----------
 libs/libc/queue/sq_cat.c       |  64 --------------
 libs/libc/queue/sq_rem.c       |  65 --------------
 13 files changed, 185 insertions(+), 547 deletions(-)

diff --git a/drivers/audio/cxd56.h b/drivers/audio/cxd56.h
index c75491547a..cedb1f1918 100644
--- a/drivers/audio/cxd56.h
+++ b/drivers/audio/cxd56.h
@@ -216,9 +216,9 @@
 
 /* Queue helpers */
 
-#define dq_get(q)    (dq_remfirst(q))
-#define dq_put(q,n) (dq_addlast((dq_entry_t*)n,(q)))
-#define dq_put_back(q,n) (dq_addfirst((dq_entry_t*)n,(q)))
+#define dq_get(q)    dq_remfirst(q)
+#define dq_put(q,n) dq_addlast((dq_entry_t*)(n),(q))
+#define dq_put_back(q,n) dq_addfirst((dq_entry_t*)(n),(q))
 #define dq_clear(q) \
   do \
     { \
diff --git a/include/queue.h b/include/queue.h
index 39c55e5220..42f3b28a0e 100644
--- a/include/queue.h
+++ b/include/queue.h
@@ -67,6 +67,186 @@
     } \
   while (0)
 
+#define sq_addfirst(p, q) \
+  do \
+    { \
+      FAR sq_entry_t *tmp_node = (p); \
+      tmp_node->flink = (q)->head; \
+      if (!(q)->head) \
+        { \
+          (q)->tail = tmp_node; \
+        } \
+      (q)->head = tmp_node; \
+    } \
+  while (0)
+
+#define dq_addfirst(p, q) \
+  do \
+    { \
+      FAR dq_entry_t *tmp_node = (p); \
+      tmp_node->blink = NULL; \
+      tmp_node->flink = (q)->head; \
+      if (!(q)->head) \
+        { \
+          (q)->head = tmp_node; \
+          (q)->tail = tmp_node; \
+        } \
+      else \
+        { \
+          (q)->head->blink = tmp_node; \
+          (q)->head = tmp_node; \
+        } \
+    } \
+  while (0)
+
+#define sq_addlast(p, q) \
+  do \
+    { \
+      FAR sq_entry_t *tmp_node = (p); \
+      tmp_node->flink = NULL; \
+      if (!(q)->head) \
+        { \
+          (q)->head = tmp_node; \
+          (q)->tail = tmp_node; \
+        } \
+      else \
+        { \
+          (q)->tail->flink = tmp_node; \
+          (q)->tail        = tmp_node; \
+        } \
+    } \
+  while (0)
+
+#define dq_addlast(p, q) \
+  do \
+    { \
+      FAR dq_entry_t *tmp_node = (p); \
+      tmp_node->flink = NULL; \
+      tmp_node->blink = (q)->tail; \
+      if (!(q)->head) \
+        { \
+          (q)->head = tmp_node; \
+          (q)->tail = tmp_node; \
+        } \
+      else \
+        { \
+          (q)->tail->flink = tmp_node; \
+          (q)->tail        = tmp_node; \
+        } \
+    } \
+  while (0)
+
+#define dq_addbefore(n, p, q) \
+  do \
+    { \
+      FAR dq_entry_t *_tmp_node = (p); \
+      if (!(q)->head || (n) == (q)->head) \
+        { \
+          dq_addfirst(_tmp_node, q); \
+        } \
+      else \
+        { \
+          FAR dq_entry_t *tmp_prev = (n)->blink; \
+          _tmp_node->flink = (n); \
+          _tmp_node->blink = tmp_prev; \
+          tmp_prev->flink = _tmp_node; \
+          (n)->blink = _tmp_node; \
+        } \
+    } \
+  while (0)
+
+#define sq_for_every(q, p) \
+  for((p) = (q)->head; (p) != NULL; (p) = (p)->flink)
+
+#define sq_rem(p, q) \
+  do \
+    { \
+      FAR sq_entry_t *tmp_node = (p); \
+      if ((q)->head && tmp_node) \
+        { \
+          if (tmp_node == (q)->head) \
+            { \
+              (q)->head = tmp_node->flink; \
+              if (tmp_node == (q)->tail) \
+                { \
+                  (q)->tail = NULL; \
+                } \
+            } \
+          else \
+            { \
+              FAR sq_entry_t *tmp_prev; \
+              sq_for_every(q, tmp_prev) \
+                { \
+                  if (tmp_prev->flink == tmp_node) \
+                    { \
+                      sq_remafter(tmp_prev, q); \
+                    } \
+                } \
+            } \
+        } \
+    } \
+  while (0)
+
+#define dq_rem(p, q) \
+  do \
+    { \
+      FAR dq_entry_t *tmp_node = (p); \
+      FAR dq_entry_t *tmp_prev = tmp_node->blink; \
+      FAR dq_entry_t *tmp_next = tmp_node->flink; \
+      if (!tmp_prev) \
+        { \
+          (q)->head = tmp_next; \
+        } \
+      else \
+        { \
+          tmp_prev->flink = tmp_next; \
+        } \
+      if (!tmp_next) \
+        { \
+          (q)->tail = tmp_prev; \
+        } \
+      else \
+        { \
+          tmp_next->blink = tmp_prev; \
+        } \
+      tmp_node->flink = NULL; \
+      tmp_node->blink = NULL; \
+    } \
+  while (0)
+
+#define sq_cat(q1, q2) \
+  do \
+    { \
+      if (sq_empty(q2)) \
+        { \
+          sq_move(q1, q2); \
+        } \
+      else if (!sq_empty(q1)) \
+        { \
+          (q2)->tail->flink = (q1)->head; \
+          (q2)->tail = (q1)->tail; \
+          sq_init(q1); \
+        } \
+    } \
+  while (0)
+
+#define dq_cat(q1, q2) \
+  do \
+    { \
+      if (dq_empty(q2)) \
+        { \
+          dq_move(q1, q2); \
+        } \
+      else if (!dq_empty(q1)) \
+        { \
+          (q2)->tail->flink = (q1)->head; \
+          (q1)->head->blink = (q2)->tail; \
+          (q2)->tail = (q1)->tail; \
+          dq_init(q1); \
+        } \
+    } \
+  while (0)
+
 #define sq_next(p)  ((p)->flink)
 #define dq_next(p)  ((p)->flink)
 #define dq_prev(p)  ((p)->blink)
@@ -125,27 +305,14 @@ extern "C"
 
 /* Add nodes to queues */
 
-void sq_addfirst(FAR sq_entry_t *node, FAR sq_queue_t *queue);
-void dq_addfirst(FAR dq_entry_t *node, FAR dq_queue_t *queue);
-void sq_addlast(FAR sq_entry_t *node, FAR sq_queue_t *queue);
-void dq_addlast(FAR dq_entry_t *node, FAR dq_queue_t *queue);
 void sq_addafter(FAR sq_entry_t *prev, FAR sq_entry_t *node,
                  FAR sq_queue_t *queue);
 void dq_addafter(FAR dq_entry_t *prev, FAR dq_entry_t *node,
                  FAR dq_queue_t *queue);
-void dq_addbefore(FAR dq_entry_t *next, FAR dq_entry_t *node,
-                  FAR dq_queue_t *queue);
-
-/* Combine queues */
-
-void sq_cat(FAR sq_queue_t *queue1, FAR sq_queue_t *queue2);
-void dq_cat(FAR dq_queue_t *queue1, FAR dq_queue_t *queue2);
 
 /* Remove nodes from queues */
 
 FAR  sq_entry_t *sq_remafter(FAR sq_entry_t *node, FAR sq_queue_t *queue);
-void sq_rem(FAR sq_entry_t *node, FAR sq_queue_t *queue);
-void dq_rem(FAR dq_entry_t *node, FAR dq_queue_t *queue);
 FAR  sq_entry_t *sq_remlast(FAR sq_queue_t *queue);
 FAR  dq_entry_t *dq_remlast(FAR dq_queue_t *queue);
 FAR  sq_entry_t *sq_remfirst(FAR sq_queue_t *queue);
diff --git a/libs/libc/libc.csv b/libs/libc/libc.csv
index 112e9260de..9c24f57388 100644
--- a/libs/libc/libc.csv
+++ b/libs/libc/libc.csv
@@ -39,10 +39,6 @@
 "dlsym","dlfcn.h","defined(CONFIG_LIBC_DLFCN)","FAR void *","FAR void *","FAR const char *"
 "dlsymtab","dlfcn.h","defined(CONFIG_LIBC_DLFCN)","int","FAR const struct symtab_s *","int"
 "dq_addafter","queue.h","","void","FAR dq_entry_t *","FAR dq_entry_t *","FAR dq_queue_t *"
-"dq_addbefore","queue.h","","void","FAR dq_entry_t *","FAR dq_entry_t *","FAR dq_queue_t *"
-"dq_addfirst","queue.h","","void","FAR dq_entry_t *","FAR dq_queue_t *"
-"dq_addlast","queue.h","","void","FAR dq_entry_t *","FAR dq_queue_t *"
-"dq_rem","queue.h","","void","FAR dq_entry_t *","FAR dq_queue_t *"
 "dq_remfirst","queue.h","","FAR dq_entry_t *","FAR dq_queue_t *"
 "dq_remlast","queue.h","","FAR dq_entry_t *","FAR dq_queue_t *"
 "ether_ntoa","netinet/ether.h","","FAR char *","FAR const struct ether_addr *"
@@ -217,9 +213,6 @@
 "snprintf","stdio.h","","int","FAR char *","size_t","FAR const IPTR char *","..."
 "sprintf","stdio.h","","int","FAR char *","FAR const IPTR char *","..."
 "sq_addafter","queue.h","","void","FAR sq_entry_t *","FAR sq_entry_t *","FAR sq_queue_t *"
-"sq_addfirst","queue.h","","void","FAR sq_entry_t *","FAR sq_queue_t *"
-"sq_addlast","queue.h","","void","FAR sq_entry_t *","FAR sq_queue_t *"
-"sq_rem","queue.h","","void","FAR sq_entry_t *","FAR sq_queue_t *"
 "sq_remafter","queue.h","","FAR sq_entry_t","FAR sq_entry_t *","FAR sq_queue_t *"
 "sq_remfirst","queue.h","","FAR sq_entry_t *","FAR sq_queue_t *"
 "sq_remlast","queue.h","","FAR sq_entry_t *","FAR sq_queue_t *"
diff --git a/libs/libc/queue/Make.defs b/libs/libc/queue/Make.defs
index abb120f36f..3480aaf7b8 100644
--- a/libs/libc/queue/Make.defs
+++ b/libs/libc/queue/Make.defs
@@ -20,10 +20,8 @@
 
 # Add the queue C files to the build
 
-CSRCS += sq_addlast.c sq_addfirst.c sq_addafter.c sq_cat.c
-CSRCS += sq_rem.c sq_remlast.c sq_remfirst.c sq_remafter.c sq_count.c
-CSRCS += dq_addlast.c dq_addfirst.c dq_addafter.c dq_addbefore.c dq_cat.c
-CSRCS += dq_rem.c dq_remlast.c dq_remfirst.c dq_count.c
+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_count.c
 
 # Add the queue directory to the build
 
diff --git a/libs/libc/queue/dq_addbefore.c b/libs/libc/queue/dq_addbefore.c
deleted file mode 100644
index ad6272f44a..0000000000
--- a/libs/libc/queue/dq_addbefore.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/dq_addbefore.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 <queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: dq_addbefore
- *
- * Description:
- *   dq_addbefore adds 'node' before 'next' in 'queue'
- *
- ****************************************************************************/
-
-void dq_addbefore(FAR dq_entry_t *next, FAR dq_entry_t *node,
-                  dq_queue_t *queue)
-{
-  if (!queue->head || next == queue->head)
-    {
-      dq_addfirst(node, queue);
-    }
-  else
-    {
-      FAR dq_entry_t *prev = next->blink;
-      node->flink = next;
-      node->blink = prev;
-      prev->flink = node;
-      next->blink = node;
-    }
-}
diff --git a/libs/libc/queue/dq_addfirst.c b/libs/libc/queue/dq_addfirst.c
deleted file mode 100644
index ef6766e0a8..0000000000
--- a/libs/libc/queue/dq_addfirst.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/dq_addfirst.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 <queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: dq_addfirst
- *
- * Description:
- *  dq_addfirst affs 'node' at the beginning of 'queue'
- *
- ****************************************************************************/
-
-void dq_addfirst(FAR dq_entry_t *node, dq_queue_t *queue)
-{
-  node->blink = NULL;
-  node->flink = queue->head;
-
-  if (!queue->head)
-    {
-      queue->head = node;
-      queue->tail = node;
-    }
-  else
-    {
-      queue->head->blink = node;
-      queue->head = node;
-    }
-}
diff --git a/libs/libc/queue/dq_addlast.c b/libs/libc/queue/dq_addlast.c
deleted file mode 100644
index 00c315efc9..0000000000
--- a/libs/libc/queue/dq_addlast.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/dq_addlast.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 <queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: dq_addlast
- *
- * Description:
- *   dq_addlast adds 'node' to the end of 'queue'
- *
- ****************************************************************************/
-
-void dq_addlast(FAR dq_entry_t *node, dq_queue_t *queue)
-{
-  node->flink = NULL;
-  node->blink = queue->tail;
-
-  if (!queue->head)
-    {
-      queue->head = node;
-      queue->tail = node;
-    }
-  else
-    {
-      queue->tail->flink = node;
-      queue->tail        = node;
-    }
-}
diff --git a/libs/libc/queue/dq_cat.c b/libs/libc/queue/dq_cat.c
deleted file mode 100644
index b6be346310..0000000000
--- a/libs/libc/queue/dq_cat.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/dq_cat.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 <assert.h>
-#include <queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: dq_cat
- *
- * Description:
- *   Move the content of queue1 to the end of queue2.
- *
- ****************************************************************************/
-
-void dq_cat(FAR dq_queue_t *queue1, FAR dq_queue_t *queue2)
-{
-  DEBUGASSERT(queue1 != NULL && queue2 != NULL);
-
-  /* If queue2 is empty, then just move queue1 to queue2 */
-
-  if (dq_empty(queue2))
-    {
-      dq_move(queue1, queue2);
-    }
-
-  /* Do nothing if queue1 is empty */
-
-  else if (!dq_empty(queue1))
-    {
-      /* Attach the head of queue1 to the final entry of queue2 */
-
-      queue2->tail->flink = queue1->head;
-      queue1->head->blink = queue2->tail;
-
-      /* The tail of queue1 is the new tail of queue2 */
-
-      queue2->tail = queue1->tail;
-      dq_init(queue1);
-    }
-}
diff --git a/libs/libc/queue/dq_rem.c b/libs/libc/queue/dq_rem.c
deleted file mode 100644
index 465599fb94..0000000000
--- a/libs/libc/queue/dq_rem.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/dq_rem.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 <queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: dq_rem
- *
- * Description:
- *   dq_rem removes 'node' from 'queue'
- *
- ****************************************************************************/
-
-void dq_rem(FAR dq_entry_t *node, dq_queue_t *queue)
-{
-  FAR dq_entry_t *prev = node->blink;
-  FAR dq_entry_t *next = node->flink;
-
-  if (!prev)
-    {
-      queue->head = next;
-    }
-  else
-    {
-      prev->flink = next;
-    }
-
-  if (!next)
-    {
-      queue->tail = prev;
-    }
-  else
-    {
-      next->blink = prev;
-    }
-
-  node->flink = NULL;
-  node->blink = NULL;
-}
diff --git a/libs/libc/queue/sq_addfirst.c b/libs/libc/queue/sq_addfirst.c
deleted file mode 100644
index 58312e39f3..0000000000
--- a/libs/libc/queue/sq_addfirst.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/sq_addfirst.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 <queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: sq_addfirst
- *
- * Description:
- *   The sq_addfirst function places the 'node' at the head of the 'queue'
- *
- ****************************************************************************/
-
-void sq_addfirst(FAR sq_entry_t *node, sq_queue_t *queue)
-{
-  node->flink = queue->head;
-  if (!queue->head)
-    {
-      queue->tail = node;
-    }
-
-  queue->head = node;
-}
diff --git a/libs/libc/queue/sq_addlast.c b/libs/libc/queue/sq_addlast.c
deleted file mode 100644
index b253367c0b..0000000000
--- a/libs/libc/queue/sq_addlast.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/sq_addlast.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 <queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: sq_addlast
- *
- * Description:
- *   The sq_addlast function places the 'node' at the tail of
- *   the 'queue'
- ****************************************************************************/
-
-void sq_addlast(FAR sq_entry_t *node, sq_queue_t *queue)
-{
-  node->flink = NULL;
-  if (!queue->head)
-    {
-      queue->head = node;
-      queue->tail = node;
-    }
-  else
-    {
-      queue->tail->flink = node;
-      queue->tail        = node;
-    }
-}
diff --git a/libs/libc/queue/sq_cat.c b/libs/libc/queue/sq_cat.c
deleted file mode 100644
index 1286493f6a..0000000000
--- a/libs/libc/queue/sq_cat.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/sq_cat.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 <assert.h>
-#include <queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: sq_cat
- *
- * Description:
- *   Move the content of queue1 to the end of queue2.
- *
- ****************************************************************************/
-
-void sq_cat(FAR sq_queue_t *queue1, FAR sq_queue_t *queue2)
-{
-  DEBUGASSERT(queue1 != NULL && queue2 != NULL);
-
-  /* If queue2 is empty, then just move queue1 to queue2 */
-
-  if (sq_empty(queue2))
-    {
-      sq_move(queue1, queue2);
-    }
-
-  /* Do nothing if queue1 is empty */
-
-  else if (!sq_empty(queue1))
-    {
-      /* Attach the head of queue1 to the final entry of queue2 */
-
-      queue2->tail->flink = queue1->head;
-
-      /* The tail of queue1 is the new tail of queue2 */
-
-      queue2->tail = queue1->tail;
-      sq_init(queue1);
-    }
-}
diff --git a/libs/libc/queue/sq_rem.c b/libs/libc/queue/sq_rem.c
deleted file mode 100644
index 2b5ddd0e29..0000000000
--- a/libs/libc/queue/sq_rem.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- * libs/libc/queue/sq_rem.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 <queue.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: sq_rem
- *
- * Description:
- *   sq_rem removes a 'node' for 'queue.'
- *
- ****************************************************************************/
-
-void sq_rem(FAR sq_entry_t *node, sq_queue_t *queue)
-{
-  if (queue->head && node)
-    {
-      if (node == queue->head)
-        {
-          queue->head = node->flink;
-          if (node == queue->tail)
-            {
-              queue->tail = NULL;
-            }
-        }
-      else
-        {
-          FAR sq_entry_t *prev;
-
-          for (prev = (FAR sq_entry_t *)queue->head;
-               prev && prev->flink != node;
-               prev = prev->flink);
-
-          if (prev)
-            {
-              sq_remafter(prev, queue);
-            }
-        }
-    }
-}