You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/10/19 18:05:35 UTC

[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #4698: mq_open: add long file name check and parameter check

gustavonihei commented on a change in pull request #4698:
URL: https://github.com/apache/incubator-nuttx/pull/4698#discussion_r732120751



##########
File path: sched/mqueue/mq_msgqalloc.c
##########
@@ -49,50 +49,58 @@
  *   attr   - The mq_maxmsg attribute is used at the time that the message
  *            queue is created to determine the maximum number of
  *            messages that may be placed in the message queue.
+ *   msgq   - This parameter is a address of a pointer
  *
  * Returned Value:
- *   The allocated and initialized message queue structure or NULL in the
- *   event of a failure.
+ *   IF the function runs successfully,will return Zero(OK),else will
+ *   return a error code.
+ *
+ *   EINVAL    attr is a null pointer and attr->mq_mqssize or attr->mq_maxmsg
+ *             is an invalid value.
+ *   ENOMEM    No memery to alloc.
  *
  ****************************************************************************/
 
-FAR struct mqueue_inode_s *nxmq_alloc_msgq(FAR struct mq_attr *attr)
+int nxmq_alloc_msgq(FAR struct mq_attr *attr,
+                    FAR struct mqueue_inode_s **msgq)
 {
-  FAR struct mqueue_inode_s *msgq;

Review comment:
       Instead of manipulation the function argument throughout the its body, how about keeping the code as it is and just copying the local variable pointer to the newly allocated `struct mqueue_inode_s` before returning?
   
   I think it will result in a much cleaner code.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org