mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-10 23:57:03 +08:00
Fix indentation in scoped_mmap.h
gdb/ChangeLog: * common/scoped_mmap.h (class scoped_mmap): Fix indentation.
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
2018-07-24 Simon Marchi <simon.marchi@ericsson.com>
|
||||||
|
|
||||||
|
* common/scoped_mmap.h (class scoped_mmap): Fix indentation.
|
||||||
|
|
||||||
2018-07-24 Tom Tromey <tom@tromey.com>
|
2018-07-24 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* utils.c (malloc, realloc, free): Don't declare.
|
* utils.c (malloc, realloc, free): Don't declare.
|
||||||
|
@ -35,34 +35,35 @@ public:
|
|||||||
scoped_mmap () noexcept : m_mem (MAP_FAILED), m_length (0) {}
|
scoped_mmap () noexcept : m_mem (MAP_FAILED), m_length (0) {}
|
||||||
scoped_mmap (void *addr, size_t length, int prot, int flags, int fd,
|
scoped_mmap (void *addr, size_t length, int prot, int flags, int fd,
|
||||||
off_t offset) noexcept : m_length (length)
|
off_t offset) noexcept : m_length (length)
|
||||||
{
|
{
|
||||||
m_mem = mmap (addr, m_length, prot, flags, fd, offset);
|
m_mem = mmap (addr, m_length, prot, flags, fd, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
~scoped_mmap ()
|
~scoped_mmap ()
|
||||||
{
|
{
|
||||||
if (m_mem != MAP_FAILED)
|
if (m_mem != MAP_FAILED)
|
||||||
munmap (m_mem, m_length);
|
munmap (m_mem, m_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
DISABLE_COPY_AND_ASSIGN (scoped_mmap);
|
DISABLE_COPY_AND_ASSIGN (scoped_mmap);
|
||||||
|
|
||||||
void *release () noexcept
|
void *release () noexcept
|
||||||
{
|
{
|
||||||
void *mem = m_mem;
|
void *mem = m_mem;
|
||||||
m_mem = MAP_FAILED;
|
m_mem = MAP_FAILED;
|
||||||
m_length = 0;
|
m_length = 0;
|
||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset (void *addr, size_t length, int prot, int flags, int fd,
|
void reset (void *addr, size_t length, int prot, int flags, int fd,
|
||||||
off_t offset) noexcept
|
off_t offset) noexcept
|
||||||
{
|
{
|
||||||
if (m_mem != MAP_FAILED)
|
if (m_mem != MAP_FAILED)
|
||||||
munmap (m_mem, m_length);
|
munmap (m_mem, m_length);
|
||||||
|
|
||||||
m_length = length;
|
m_length = length;
|
||||||
m_mem = mmap (addr, m_length, prot, flags, fd, offset);
|
m_mem = mmap (addr, m_length, prot, flags, fd, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size () const noexcept { return m_length; }
|
size_t size () const noexcept { return m_length; }
|
||||||
void *get () const noexcept { return m_mem; }
|
void *get () const noexcept { return m_mem; }
|
||||||
|
Reference in New Issue
Block a user