Whamcloud - gitweb
LU-8191 lnet: convert functions in utils to static
[fs/lustre-release.git] / lnet / utils / lnetconfig / cyaml.c
index 032bb5a..5d153c5 100644 (file)
@@ -242,7 +242,7 @@ static struct cYAML *cYAML_ll_pop(struct list_head *list,
        struct cYAML *obj = NULL;
 
        if (!list_empty(list)) {
-               pop = list_entry(list->next, struct cYAML_ll, list);
+               pop = list_first_entry(list, struct cYAML_ll, list);
 
                obj = pop->obj;
                if (print_info != NULL)
@@ -348,6 +348,23 @@ static bool parse_number(struct cYAML *item, const char *input)
        int subscale = 0, signsubscale = 1;
        const char *num = input;
 
+       if (!strncmp(input, "0x", 2)) {
+               int64_t hex; /* hex input is always an integer */
+               char *invalid = NULL;
+
+               errno = 0;
+               hex = strtoll(input, &invalid, 16);
+               if (errno)
+                       return false;
+               if (*invalid)
+                       return false;
+
+               item->cy_valuedouble = (double) hex;
+               item->cy_valueint = hex;
+               item->cy_type = CYAML_TYPE_NUMBER;
+               return true;
+       }
+
        if (*num == '-') {
                sign = -1;
                num++;
@@ -750,7 +767,7 @@ bool cYAML_is_sequence(struct cYAML *node)
        return (node != NULL ? node->cy_type == CYAML_TYPE_ARRAY : 0);
 }
 
-void cYAML_tree_recursive_walk(struct cYAML *node, cYAML_walk_cb cb,
+static void cYAML_tree_recursive_walk(struct cYAML *node, cYAML_walk_cb cb,
                                      bool cb_first,
                                      void *usr_data,
                                      void **out)