[17/33] sandbox: Drop os_realloc()
diff mbox series

Message ID 20200112120216.17.Id99b268986b5d9470d1932ae752c857d52c9b123@changeid
State Superseded
Delegated to: Simon Glass
Headers show
Series
  • sandbox: Move to SDL2
Related show

Commit Message

Simon Glass Jan. 12, 2020, 7:06 p.m. UTC
Due to recent changes this function is no-longer used. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/sandbox/cpu/os.c | 23 -----------------------
 include/os.h          | 22 +---------------------
 2 files changed, 1 insertion(+), 44 deletions(-)

Patch
diff mbox series

diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index d5e5b561b6..60011f7abc 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -238,29 +238,6 @@  void os_free(void *ptr)
 	}
 }
 
-void *os_realloc(void *ptr, size_t length)
-{
-	int page_size = getpagesize();
-	struct os_mem_hdr *hdr;
-	void *buf = NULL;
-
-	if (length) {
-		buf = os_malloc(length);
-		if (!buf)
-			return buf;
-		if (ptr) {
-			hdr = ptr - page_size;
-			if (length > hdr->length)
-				length = hdr->length;
-			memcpy(buf, ptr, length);
-		}
-	}
-	if (ptr)
-		os_free(ptr);
-
-	return buf;
-}
-
 void os_usleep(unsigned long usec)
 {
 	usleep(usec);
diff --git a/include/os.h b/include/os.h
index 7a4f78b9b1..1874ae674f 100644
--- a/include/os.h
+++ b/include/os.h
@@ -119,7 +119,7 @@  void os_fd_restore(void);
 void *os_malloc(size_t length);
 
 /**
- * Free memory previous allocated with os_malloc()/os_realloc()
+ * Free memory previous allocated with os_malloc()
  *
  * This returns the memory to the OS.
  *
@@ -127,26 +127,6 @@  void *os_malloc(size_t length);
  */
 void os_free(void *ptr);
 
-/**
- * Reallocate previously-allocated memory to increase/decrease space
- *
- * This works in a similar way to the C library realloc() function. If
- * length is 0, then ptr is freed. Otherwise the space used by ptr is
- * expanded or reduced depending on whether length is larger or smaller
- * than before.
- *
- * If ptr is NULL, then this is similar to calling os_malloc().
- *
- * This function may need to move the memory block to make room for any
- * extra space, in which case the new pointer is returned.
- *
- * \param ptr		Pointer to memory block to reallocate
- * \param length	New length for memory block
- * \return pointer to new memory block, or NULL on failure or if length
- *	is 0.
- */
-void *os_realloc(void *ptr, size_t length);
-
 /**
  * Access to the usleep function of the os
  *