DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦419568dd9⟧ TextFile

    Length: 568 (0x238)
    Types: TextFile
    Notes: UNIX file
    Names: »mcopy.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦f4b8d8c84⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »libmp/mcopy.c« 

TextFile

#include "mprec.h"
#include <assert.h>


/*
 *	Mcopy sets the mint pointed to by "b" to a copy of the mint
 *	pointed to by "a".  This is used when a scratch copy is needed.
 */

void
mcopy(a, b)
register mint *a, *b;
{
	register char *ap, *bp;
	register unsigned count;

	/* throw away old value and allocate space for new one */
	mpfree(b->val);
	b->val = (char *)mpalc(a->len);
	b->len = a->len;

	/* copy value */
	ap = a->val;
	bp = b->val;
	count = a->len;
	while (count-- != 0)
		*bp++ = *ap++;
	assert(bp == b->val + b->len);
	assert(ap == a->val + a->len);
}