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:
parent
810451c76b
commit
c7777121e8
|
@ -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);
|
struct scm *vector_set_x_ (struct scm *x, long i, struct scm *e);
|
||||||
FUNCTION builtin_function (struct scm *builtin);
|
FUNCTION builtin_function (struct scm *builtin);
|
||||||
char *cell_bytes (struct scm *x);
|
char *cell_bytes (struct scm *x);
|
||||||
char *news_bytes (struct scm *x);
|
|
||||||
int peekchar ();
|
int peekchar ();
|
||||||
int readchar ();
|
int readchar ();
|
||||||
int unreadchar ();
|
int unreadchar ();
|
||||||
|
|
9
src/gc.c
9
src/gc.c
|
@ -40,13 +40,6 @@ cell_bytes (struct scm *x)
|
||||||
return p + (2 * sizeof (long));
|
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
|
#define U10 10U
|
||||||
// CONSTANT U10 10
|
// CONSTANT U10 10
|
||||||
#define U100 100U
|
#define U100 100U
|
||||||
|
@ -504,7 +497,7 @@ gc_copy (struct scm *old) /*:((internal)) */
|
||||||
else if (new->type == TBYTES)
|
else if (new->type == TBYTES)
|
||||||
{
|
{
|
||||||
char const *src = cell_bytes (old);
|
char const *src = cell_bytes (old);
|
||||||
char *dest = news_bytes (new);
|
char *dest = cell_bytes (new);
|
||||||
size_t length = new->length;
|
size_t length = new->length;
|
||||||
memcpy (dest, src, length);
|
memcpy (dest, src, length);
|
||||||
g_free = g_free + ((bytes_cells (length) - 1) * M2_CELL_SIZE);
|
g_free = g_free + ((bytes_cells (length) - 1) * M2_CELL_SIZE);
|
||||||
|
|
Loading…
Reference in a new issue