Remove TARGET_XFER_STATUS_ERROR_P
authorYao Qi <yao@codesourcery.com>
Sun, 23 Feb 2014 04:24:08 +0000 (12:24 +0800)
committerYao Qi <yao@codesourcery.com>
Mon, 24 Feb 2014 03:27:37 +0000 (11:27 +0800)
This patch removes macro TARGET_XFER_STATUS_ERROR_P, as Pedro pointed
out during patches review that TARGET_XFER_STATUS_ERROR_P tends to
be unnecessary.

gdb:

2014-02-24  Yao Qi  <yao@codesourcery.com>

* target.h (TARGET_XFER_STATUS_ERROR_P): Remove.
* corefile.c (read_memory): Adjusted.
* target.c (target_write_with_progress): Adjusted.

gdb/ChangeLog
gdb/corefile.c
gdb/target.c
gdb/target.h

index 3b199ac9b6395e3be368730cea91066a3f6f6bfe..01be0a305550ab725c2831cb969ec0abf015407b 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-24  Yao Qi  <yao@codesourcery.com>
+
+       * target.h (TARGET_XFER_STATUS_ERROR_P): Remove.
+       * corefile.c (read_memory): Adjusted.
+       * target.c (target_write_with_progress): Adjusted.
+
 2014-02-23  Yao Qi  <yao@codesourcery.com>
 
        Revert two patches:
index 048669b9d2e68613596d5a94c8f7841a1f2e2f73..815adaf46a08053487fe65bc2984f4228cc76660 100644 (file)
@@ -260,13 +260,10 @@ read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
                                    memaddr + xfered, len - xfered,
                                    &xfered_len);
 
-      if (status == TARGET_XFER_EOF)
-       memory_error (TARGET_XFER_E_IO, memaddr + xfered);
+      if (status != TARGET_XFER_OK)
+       memory_error (status == TARGET_XFER_EOF ? TARGET_XFER_E_IO : status,
+                     memaddr + xfered);
 
-      if (TARGET_XFER_STATUS_ERROR_P (status))
-       memory_error (status, memaddr + xfered);
-
-      gdb_assert (status == TARGET_XFER_OK);
       xfered += xfered_len;
       QUIT;
     }
index 0f3bd30165241bf664a5e4dcae4ab4c227df2f5f..60a11dddb6c50ea0666713846cf8f267b84f468c 100644 (file)
@@ -2002,12 +2002,9 @@ target_write_with_progress (struct target_ops *ops,
                                     offset + xfered, len - xfered,
                                     &xfered_len);
 
-      if (status == TARGET_XFER_EOF)
-       return xfered;
-      if (TARGET_XFER_STATUS_ERROR_P (status))
-       return -1;
+      if (status != TARGET_XFER_OK)
+       return status == TARGET_XFER_EOF ? xfered : -1;
 
-      gdb_assert (status == TARGET_XFER_OK);
       if (progress)
        (*progress) (xfered_len, baton);
 
index 6cc13370759eeee9d02f5bae5bc6286d9ee3f80e..4254609fca844c2f0632ee8227f073dd07d2fef2 100644 (file)
@@ -225,8 +225,6 @@ enum target_xfer_status
   /* Keep list in sync with target_xfer_error_to_string.  */
 };
 
-#define TARGET_XFER_STATUS_ERROR_P(STATUS) ((STATUS) < TARGET_XFER_EOF)
-
 /* Return the string form of ERR.  */
 
 extern const char *target_xfer_status_to_string (enum target_xfer_status err);