]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/common/hw-tree.c
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / sim / common / hw-tree.c
index 99560bf320d2d3a38473b5fdcb7bf3e153f255fb..6aa0a48ab8747940560c6a41080efc8e68dff29e 100644 (file)
@@ -1,6 +1,6 @@
 /* The common simulator framework for GDB, the GNU Debugger.
 
-   Copyright 2002, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright 2002-2013 Free Software Foundation, Inc.
 
    Contributed by Andrew Cagney and Red Hat.
 
@@ -96,14 +96,14 @@ split_device_specifier (struct hw *current,
        {
          alias[len] = device_specifier[len];
          len++;
-         if (len >= sizeof(alias))
+         if (len >= sizeof (alias))
            hw_abort (NULL, "split_device_specifier: buffer overflow");
        }
       alias[len] = '\0';
       if (aliases != NULL
          && hw_find_property (aliases, alias))
        {
-         strcpy (spec->buf, hw_find_string_property(aliases, alias));
+         strcpy (spec->buf, hw_find_string_property (aliases, alias));
          strcat (spec->buf, device_specifier + len);
        }
       else
@@ -113,23 +113,23 @@ split_device_specifier (struct hw *current,
     }
   else
     {
-      strcpy(spec->buf, device_specifier);
+      strcpy (spec->buf, device_specifier);
     }
 
   /* check no overflow */
-  if (strlen(spec->buf) >= sizeof(spec->buf))
+  if (strlen (spec->buf) >= sizeof (spec->buf))
     hw_abort (NULL, "split_device_specifier: buffer overflow\n");
 
   /* strip leading spaces */
   chp = spec->buf;
-  while (*chp != '\0' && isspace(*chp))
+  while (*chp != '\0' && isspace (*chp))
     chp++;
   if (*chp == '\0')
     return 0;
 
   /* find the path and terminate it with null */
   spec->path = chp;
-  while (*chp != '\0' && !isspace(*chp))
+  while (*chp != '\0' && !isspace (*chp))
     chp++;
   if (*chp != '\0')
     {
@@ -138,7 +138,7 @@ split_device_specifier (struct hw *current,
     }
 
   /* and any value */
-  while (*chp != '\0' && isspace(*chp))
+  while (*chp != '\0' && isspace (*chp))
     chp++;
   spec->value = chp;
 
@@ -156,11 +156,11 @@ split_device_specifier (struct hw *current,
     }
   else
     {
-      chp = strrchr(spec->path, '/');
+      chp = strrchr (spec->path, '/');
       if (chp == NULL)
        {
          spec->property = spec->path;
-         spec->path = strchr(spec->property, '\0');
+         spec->path = strchr (spec->property, '\0');
        }
       else
        {
@@ -250,7 +250,7 @@ split_device_name (name_specifier *spec)
   /* break out the base */
   if (spec->name[0] == '(')
     {
-      chp = strchr(spec->name, ')');
+      chp = strchr (spec->name, ')');
       if (chp == NULL)
        {
          spec->family = spec->name;
@@ -267,7 +267,7 @@ split_device_name (name_specifier *spec)
       spec->family = spec->name;
     }
   /* now break out the unit */
-  chp = strchr(spec->name, '@');
+  chp = strchr (spec->name, '@');
   if (chp == NULL)
     {
       spec->unit = NULL;
@@ -280,7 +280,7 @@ split_device_name (name_specifier *spec)
       spec->unit = chp;
     }
   /* finally any args */
-  chp = strchr(chp, ':');
+  chp = strchr (chp, ':');
   if (chp == NULL)
     spec->args = NULL;
   else
@@ -442,11 +442,11 @@ split_fill_path (struct hw *current,
 /* <non-white-space> */
 
 static const char *
-skip_token(const char *chp)
+skip_token (const char *chp)
 {
-  while (!isspace(*chp) && *chp != '\0')
+  while (!isspace (*chp) && *chp != '\0')
     chp++;
-  while (isspace(*chp) && *chp != '\0')
+  while (isspace (*chp) && *chp != '\0')
     chp++;
   return chp;
 }
@@ -502,7 +502,7 @@ parse_size (struct hw *current,
   int i;
   int nr;
   const char *curr = chp;
-  memset(size, 0, sizeof(*size));
+  memset (size, 0, sizeof (*size));
   /* parse the numeric list */
   size->nr_cells = hw_unit_nr_size_cells (bus);
   nr = 0;
@@ -554,9 +554,9 @@ parse_reg_property (struct hw *current,
   chp = property_value;
   for (reg_nr = 0; reg_nr < nr_regs; reg_nr++)
     {
-      chp = parse_address (current, hw_parent(current),
+      chp = parse_address (current, hw_parent (current),
                           chp, &regs[reg_nr].address);
-      chp = parse_size (current, hw_parent(current),
+      chp = parse_size (current, hw_parent (current),
                        chp, &regs[reg_nr].size);
     }
 
@@ -584,7 +584,7 @@ parse_ranges_property (struct hw *current,
   nr_ranges = count_entries (current, property_name, property_value, 3);
 
   /* create a property of that size */
-  ranges = zalloc (nr_ranges * sizeof(*ranges));
+  ranges = zalloc (nr_ranges * sizeof (*ranges));
 
   /* fill it in */
   chp = property_value;
@@ -592,7 +592,7 @@ parse_ranges_property (struct hw *current,
     {
       chp = parse_address (current, current,
                           chp, &ranges[range_nr].child_address);
-      chp = parse_address (current, hw_parent(current),
+      chp = parse_address (current, hw_parent (current),
                           chp, &ranges[range_nr].parent_address);
       chp = parse_size (current, current,
                        chp, &ranges[range_nr].size);
@@ -641,7 +641,7 @@ parse_integer_property (struct hw *current,
        }
       /* perhaps integer array property is better */
       hw_add_array_property (current, property_name, words,
-                            sizeof(words[0]) * nr_entries);
+                            sizeof (words[0]) * nr_entries);
     }
 }
 
@@ -669,7 +669,7 @@ parse_string_property (struct hw *current,
   approx_nr_strings = (approx_nr_strings) / 2;
 
   /* create a string buffer for that many (plus a null) */
-  strings = (char**) zalloc ((approx_nr_strings + 1) * sizeof(char*));
+  strings = (char**) zalloc ((approx_nr_strings + 1) * sizeof (char*));
 
   /* now find all the strings */
   chp = property_value;
@@ -724,10 +724,10 @@ parse_string_property (struct hw *current,
        {
          /* copy over a single unquoted token */
          int len = 0;
-         while (chp[len] != '\0' && !isspace(chp[len]))
+         while (chp[len] != '\0' && !isspace (chp[len]))
            len++;
-         strings[nr_strings] = zalloc(len + 1);
-         strncpy(strings[nr_strings], chp, len);
+         strings[nr_strings] = zalloc (len + 1);
+         strncpy (strings[nr_strings], chp, len);
          strings[nr_strings][len] = '\0';
          chp += len;
        }
@@ -756,7 +756,7 @@ parse_string_property (struct hw *current,
       nr_strings--;
       free (strings[nr_strings]);
     }
-  free(strings);
+  free (strings);
 }
 
 
@@ -901,7 +901,7 @@ hw_tree_vparse (struct hw *current,
                    nr_words += 1;
                  }
                hw_add_array_property (current, spec.property,
-                                      words, sizeof(words[0]) * nr_words);
+                                      words, sizeof (words[0]) * nr_words);
                break;
              }
            case '"':
@@ -932,14 +932,14 @@ hw_tree_vparse (struct hw *current,
                  {
                    parse_ranges_property (current, spec.property, spec.value);
                  }
-               else if (isdigit(spec.value[0])
-                        || (spec.value[0] == '-' && isdigit(spec.value[1]))
-                        || (spec.value[0] == '+' && isdigit(spec.value[1])))
+               else if (isdigit (spec.value[0])
+                        || (spec.value[0] == '-' && isdigit (spec.value[1]))
+                        || (spec.value[0] == '+' && isdigit (spec.value[1])))
                  {
-                   parse_integer_property(current, spec.property, spec.value);
+                   parse_integer_property (current, spec.property, spec.value);
                  }
                else
-                 parse_string_property(current, spec.property, spec.value);
+                 parse_string_property (current, spec.property, spec.value);
                break;
              }
            }
@@ -998,7 +998,7 @@ print_address (struct hw *bus,
               struct printer *p)
 {
   char unit[32];
-  hw_unit_encode (bus, phys, unit, sizeof(unit));
+  hw_unit_encode (bus, phys, unit, sizeof (unit));
   p->print (p->file, " %s", unit);
 }
 
@@ -1146,7 +1146,7 @@ print_properties (struct hw *me,
              }
            case boolean_property:
              {
-               int b = hw_find_boolean_property(me, property->name);
+               int b = hw_find_boolean_property (me, property->name);
                p->print (p->file, " %s", b ? "true"  : "false");
                break;
              }
@@ -1156,7 +1156,7 @@ print_properties (struct hw *me,
                if (property->array != NULL)
                  {
                    device_instance *instance = hw_find_ihandle_property (me, property->name);
-                   p->print (p->file, " *%s", device_instance_path(instance));
+                   p->print (p->file, " *%s", device_instance_path (instance));
                  }
                else
                  {
@@ -1211,8 +1211,8 @@ print_interrupts (struct hw *me,
   struct printer *p = data;
   char src[32];
   char dst[32];
-  hw_port_encode (me, my_port, src, sizeof(src), output_port);
-  hw_port_encode (dest, dest_port, dst, sizeof(dst), input_port);
+  hw_port_encode (me, my_port, src, sizeof (src), output_port);
+  hw_port_encode (dest, dest_port, dst, sizeof (dst), input_port);
   p->print (p->file,
            "%s > %s %s %s\n",
            hw_path (me),
@@ -1247,19 +1247,19 @@ hw_tree_print (struct hw *root,
 \f
 #if NOT_YET
 device_instance *
-tree_instance(struct hw *root,
-             const char *device_specifier)
+tree_instance (struct hw *root,
+              const char *device_specifier)
 {
   /* find the device node */
   struct hw *me;
   name_specifier spec;
-  if (!split_device_specifier(root, device_specifier, &spec))
+  if (!split_device_specifier (root, device_specifier, &spec))
     return NULL;
-  me = split_find_device(root, &spec);
+  me = split_find_device (root, &spec);
   if (spec.name != NULL)
     return NULL;
   /* create the instance */
-  return device_create_instance(me, device_specifier, spec.last_args);
+  return device_create_instance (me, device_specifier, spec.last_args);
 }
 #endif