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.
This commit is contained in:
Gabriel Wicki 2022-05-10 22:14:31 +02:00 committed by Jan (janneke) Nieuwenhuizen
parent 810451c76b
commit c7777121e8
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 1 additions and 9 deletions

View file

@ -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 ();

View file

@ -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);