From 1dd7b40fafd6b2b3b06251a2dd5681fc8752c686 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sun, 18 Feb 2024 02:04:21 +0200
Subject: [PATCH 29/29] fc_cmdline.c: Replace NULLs with nullptrs

See RM #269

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 utility/fc_cmdline.c | 22 +++++++++++-----------
 utility/fc_cmdline.h |  2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/utility/fc_cmdline.c b/utility/fc_cmdline.c
index cab4fceead..d9419b03db 100644
--- a/utility/fc_cmdline.c
+++ b/utility/fc_cmdline.c
@@ -27,7 +27,7 @@
 
 #include "fc_cmdline.h"
 
-/* get 'struct cmdline_value_list' and related functions: */
+/* Get 'struct cmdline_value_list' and related functions: */
 #define SPECLIST_TAG cmdline_value
 #define SPECLIST_TYPE char
 #include "speclist.h"
@@ -36,10 +36,10 @@
     TYPED_LIST_ITERATE(char *, vallist, pvalue)
 #define cmdline_value_list_iterate_end LIST_ITERATE_END
 
-static struct cmdline_value_list *cmdline_values = NULL;
+static struct cmdline_value_list *cmdline_values = nullptr;
 
 /**********************************************************************//**
-  Return a char* to the parameter of the option or NULL.
+  Return a char* to the parameter of the option or nullptr.
   *i can be increased to get next string in the array argv[].
   It is an error for the option to exist but be an empty string.
   This doesn't use log_*() because it is used before logging is set up.
@@ -53,7 +53,7 @@ char *get_option_malloc(const char *option_name,
 {
   int len = strlen(option_name);
 
-  if (gc && cmdline_values == NULL) {
+  if (gc && cmdline_values == nullptr) {
     cmdline_values = cmdline_value_list_new();
   }
 
@@ -88,7 +88,7 @@ char *get_option_malloc(const char *option_name,
     return ret;
  }
 
-  return NULL;
+  return nullptr;
 }
 
 /**********************************************************************//**
@@ -96,7 +96,7 @@ char *get_option_malloc(const char *option_name,
 **************************************************************************/
 void cmdline_option_values_free(void)
 {
-  if (cmdline_values != NULL) {
+  if (cmdline_values != nullptr) {
     cmdline_value_list_iterate(cmdline_values, pval) {
       free(pval);
     } cmdline_value_list_iterate_end;
@@ -168,28 +168,28 @@ int get_tokens(const char *str, char **tokens, size_t num_tokens,
 {
   unsigned int token;
 
-  fc_assert_ret_val(NULL != str, -1);
+  fc_assert_ret_val(str != nullptr, -1);
 
   for (token = 0; token < num_tokens && *str != '\0'; token++) {
     size_t len, padlength = 0;
 
-    /* skip leading delimiters */
+    /* Skip leading delimiters */
     str += strspn(str, delimiterset);
 
     len = fc_strcspn(str, delimiterset);
 
-    /* strip start/end quotes if they exist */
+    /* Strip start/end quotes if they exist */
     if (len >= 2) {
       if ((str[0] == '"' && str[len - 1] == '"')
           || (str[0] == '\'' && str[len - 1] == '\'')) {
         len -= 2;
-        padlength = 1; /* to set the string past the end quote */
+        padlength = 1; /* To set the string past the end quote */
         str++;
      }
    }
 
    tokens[token] = fc_malloc(len + 1);
-   (void) fc_strlcpy(tokens[token], str, len + 1); /* adds the '\0' */
+   (void) fc_strlcpy(tokens[token], str, len + 1); /* Adds the '\0' */
 
    str += len + padlength;
   }
diff --git a/utility/fc_cmdline.h b/utility/fc_cmdline.h
index 65a546387c..bea52da908 100644
--- a/utility/fc_cmdline.h
+++ b/utility/fc_cmdline.h
@@ -34,4 +34,4 @@ void cmdline_option_values_free(void);
 }
 #endif /* __cplusplus */
 
-#endif  /* FC__CMDLINE_H */
+#endif /* FC__CMDLINE_H */
-- 
2.43.0

