From c7777121e813b8aac3e07a780ca4c6d6a5ca7480 Mon Sep 17 00:00:00 2001 From: Gabriel Wicki Date: Tue, 10 May 2022 22:14:31 +0200 Subject: [PATCH] core: Remove code duplication. * src/gc.c (news_bytes): Remove copy of cell_bytes. (gc_copy): Use cell_bytes instead. * include/mes/mes.h (news_bytes): Remove prototype. --- include/mes/mes.h | 1 - src/gc.c | 9 +-------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/include/mes/mes.h b/include/mes/mes.h index 9ef6491e..337f03aa 100644 --- a/include/mes/mes.h +++ b/include/mes/mes.h @@ -153,7 +153,6 @@ struct scm *vector_ref_ (struct scm *x, long i); struct scm *vector_set_x_ (struct scm *x, long i, struct scm *e); FUNCTION builtin_function (struct scm *builtin); char *cell_bytes (struct scm *x); -char *news_bytes (struct scm *x); int peekchar (); int readchar (); int unreadchar (); diff --git a/src/gc.c b/src/gc.c index 62643bbc..4a1df7cb 100644 --- a/src/gc.c +++ b/src/gc.c @@ -40,13 +40,6 @@ cell_bytes (struct scm *x) return p + (2 * sizeof (long)); } -char * -news_bytes (struct scm *x) -{ - char *p = cast_voidp_to_charp (x); - return p + (2 * sizeof (long)); -} - #define U10 10U // CONSTANT U10 10 #define U100 100U @@ -504,7 +497,7 @@ gc_copy (struct scm *old) /*:((internal)) */ else if (new->type == TBYTES) { char const *src = cell_bytes (old); - char *dest = news_bytes (new); + char *dest = cell_bytes (new); size_t length = new->length; memcpy (dest, src, length); g_free = g_free + ((bytes_cells (length) - 1) * M2_CELL_SIZE);