TimJTi commented on code in PR #3110:
URL: https://github.com/apache/nuttx-apps/pull/3110#discussion_r2167562958


##########
system/settings/settings.c:
##########
@@ -494,24 +496,24 @@ static int get_ip(FAR setting_t *setting, FAR struct 
in_addr *ip)
 {
   int ret;
   assert(setting);
-  if ((setting->type != SETTING_IP_ADDR) &&
-      (setting->type != SETTING_STRING))
-    {
-      return -EACCES;
-    }
 
-  if (setting->type == SETTING_IP_ADDR)
+  switch (setting->type)
     {
-      memcpy(ip, &setting->val.ip, sizeof(struct in_addr));
-      ret = OK;
-    }
-  else if (setting->type == SETTING_STRING)
-    {
-      ret = inet_pton(AF_INET, setting->val.s, ip);
-    }
-  else
-    {
-      ret = -EINVAL;
+      case SETTING_IP_ADDR:
+        {

Review Comment:
   > > Case logic in braces. It is preferable that all case logic (except for 
the break) be enclosed in braces. If you need to instantiate local variables in 
case logic, then that logic must be surrounded with braces.
   > 
   > Case logic in braces is indeed preferred. Should I revert my previous 
commit or removing the last bracket in existence?
   
   My opinion? Yes. I would like consistent code everywhere and don't like the 
"preferable" qualification in the guide. But I am not an official reviewer so 
suggest the views of others wins the day....and maybe we need to update the 
guide here?
   



-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to