Constify add_com
[deliverable/binutils-gdb.git] / gdb / memattr.c
index 6ef8e39e0229962ffc240a816cd5a45029a6207a..04986646db88b5a7325ab1292c9aae3e797138e2 100644 (file)
@@ -251,10 +251,9 @@ user_mem_clear (void)
 \f
 
 static void
-mem_command (char *args, int from_tty)
+mem_command (const char *args, int from_tty)
 {
   CORE_ADDR lo, hi;
-  char *tok;
 
   if (!args)
     error_no_arg (_("No mem"));
@@ -273,41 +272,41 @@ mem_command (char *args, int from_tty)
 
   require_user_regions (from_tty);
 
-  tok = strtok (args, " \t");
-  if (!tok)
+  std::string tok = extract_arg (&args);
+  if (tok == "")
     error (_("no lo address"));
-  lo = parse_and_eval_address (tok);
+  lo = parse_and_eval_address (tok.c_str ());
 
-  tok = strtok (NULL, " \t");
-  if (!tok)
+  tok = extract_arg (&args);
+  if (tok == "")
     error (_("no hi address"));
-  hi = parse_and_eval_address (tok);
+  hi = parse_and_eval_address (tok.c_str ());
 
   mem_attrib attrib;
-  while ((tok = strtok (NULL, " \t")) != NULL)
+  while ((tok = extract_arg (&args)) != "")
     {
-      if (strcmp (tok, "rw") == 0)
+      if (tok == "rw")
        attrib.mode = MEM_RW;
-      else if (strcmp (tok, "ro") == 0)
+      else if (tok == "ro")
        attrib.mode = MEM_RO;
-      else if (strcmp (tok, "wo") == 0)
+      else if (tok == "wo")
        attrib.mode = MEM_WO;
 
-      else if (strcmp (tok, "8") == 0)
+      else if (tok == "8")
        attrib.width = MEM_WIDTH_8;
-      else if (strcmp (tok, "16") == 0)
+      else if (tok == "16")
        {
          if ((lo % 2 != 0) || (hi % 2 != 0))
            error (_("region bounds not 16 bit aligned"));
          attrib.width = MEM_WIDTH_16;
        }
-      else if (strcmp (tok, "32") == 0)
+      else if (tok == "32")
        {
          if ((lo % 4 != 0) || (hi % 4 != 0))
            error (_("region bounds not 32 bit aligned"));
          attrib.width = MEM_WIDTH_32;
        }
-      else if (strcmp (tok, "64") == 0)
+      else if (tok == "64")
        {
          if ((lo % 8 != 0) || (hi % 8 != 0))
            error (_("region bounds not 64 bit aligned"));
@@ -315,26 +314,26 @@ mem_command (char *args, int from_tty)
        }
 
 #if 0
-      else if (strcmp (tok, "hwbreak") == 0)
+      else if (tok == "hwbreak")
        attrib.hwbreak = 1;
-      else if (strcmp (tok, "swbreak") == 0)
+      else if (tok == "swbreak")
        attrib.hwbreak = 0;
 #endif
 
-      else if (strcmp (tok, "cache") == 0)
+      else if (tok == "cache")
        attrib.cache = 1;
-      else if (strcmp (tok, "nocache") == 0)
+      else if (tok == "nocache")
        attrib.cache = 0;
 
 #if 0
-      else if (strcmp (tok, "verify") == 0)
+      else if (tok == "verify")
        attrib.verify = 1;
-      else if (strcmp (tok, "noverify") == 0)
+      else if (tok == "noverify")
        attrib.verify = 0;
 #endif
 
       else
-       error (_("unknown attribute: %s"), tok);
+       error (_("unknown attribute: %s"), tok.c_str ());
     }
 
   create_user_mem_region (lo, hi, attrib);
This page took 0.025816 seconds and 4 git commands to generate.