Use std::set in mi-main.c
[deliverable/binutils-gdb.git] / gdb / target-memory.c
index 1301e7e5cc7e111ae6b6dc3d51b006b8c14c4c65..1c8faa8e2566ee90da048357ebbc8f5b23bfe801 100644 (file)
@@ -1,7 +1,7 @@
 /* Parts of target interface that deal with accessing memory and memory-like
    objects.
 
-   Copyright (C) 2006-2013 Free Software Foundation, Inc.
+   Copyright (C) 2006-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "target.h"
 #include "memory-map.h"
 
-#include "gdb_assert.h"
-
-#include <stdio.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
+#include <algorithm>
 
 static int
 compare_block_starting_address (const void *a, const void *b)
 {
-  const struct memory_write_request *a_req = a;
-  const struct memory_write_request *b_req = b;
+  const struct memory_write_request *a_req
+    = (const struct memory_write_request *) a;
+  const struct memory_write_request *b_req
+    = (const struct memory_write_request *) b;
 
   if (a_req->begin < b_req->begin)
     return -1;
@@ -72,11 +72,11 @@ claim_memory (VEC(memory_write_request_s) *blocks,
       if (end != 0 && end <= r->begin)
        continue;
 
-      claimed_begin = max (begin, r->begin);
+      claimed_begin = std::max (begin, r->begin);
       if (end == 0)
        claimed_end = r->end;
       else
-       claimed_end = min (end, r->end);
+       claimed_end = std::min (end, r->end);
 
       if (claimed_begin == r->begin && claimed_end == r->end)
        VEC_safe_push (memory_write_request_s, *result, r);
@@ -291,7 +291,7 @@ compute_garbled_blocks (VEC(memory_write_request_s) *erased_blocks,
 static void
 cleanup_request_data (void *p)
 {
-  VEC(memory_write_request_s) **v = p;
+  VEC(memory_write_request_s) **v = (VEC(memory_write_request_s) **) p;
   struct memory_write_request *r;
   int i;
 
@@ -302,7 +302,7 @@ cleanup_request_data (void *p)
 static void
 cleanup_write_requests_vector (void *p)
 {
-  VEC(memory_write_request_s) **v = p;
+  VEC(memory_write_request_s) **v = (VEC(memory_write_request_s) **) p;
 
   VEC_free (memory_write_request_s, *v);
 }
@@ -369,7 +369,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
          for (i = 0; VEC_iterate (memory_write_request_s, garbled, i, r); ++i)
            {
              gdb_assert (r->data == NULL);
-             r->data = xmalloc (r->end - r->begin);
+             r->data = (gdb_byte *) xmalloc (r->end - r->begin);
              err = target_read_memory (r->begin, r->data, r->end - r->begin);
              if (err != 0)
                goto out;
This page took 0.029519 seconds and 4 git commands to generate.