ARSperl

 view release on metacpan or  search on metacpan

support.c  view on Meta::CPAN

/*
$header: /u1/project/ARSperl/ARSperl/RCS/support.c,v 1.25 1999/01/04 21:04:27 jcmurphy Exp jcmurphy $

    ARSperl - An ARS v2 - v5 / Perl5 Integration Kit

    Copyright (C) 1995-2003
	Joel Murphy, jmurphy@acsu.buffalo.edu
        Jeff Murphy, jcmurphy@acsu.buffalo.edu

    This program is free software; you can redistribute it and/or modify
    it under the terms as Perl itself.

    Refer to the file called "Artistic" that accompanies the source 
    distribution of ARSperl (or the one that accompanies the source 
    distribution of Perl itself) for a full description.

    Comments to:  arsperl@arsperl.org
                  (this is a *mailing list* and you must be
                   a subscriber before posting)

    Home Page: http://www.arsperl.org

*/

/* NAME
 *   support.c
 *
 * DESCRIPTION
 *   this file contains routines that are useful for translating
 *   ARS C data structures into (ars)perl "data structures" (if you will)
 */

#define __support_c_

#include "support.h"
#include "supportrev.h"


#if defined(ARSPERL_UNDEF_MALLOC) && defined(malloc)
 #undef malloc
 #undef calloc
 #undef realloc
 #undef free
#endif


int
compmem(MEMCAST * m1, MEMCAST * m2, int size)
{
	if (m1 && m2 && (size > 0)) {
#ifndef BSD
		return memcmp(m1, m2, size) ? 1 : 0;
#else
		return bcmp(m1, m2, size) ? 1 : 0;
#endif
	}
	return -1;
}

/* copy from m2 to m1 */

int
copymem(MEMCAST * m1, MEMCAST * m2, int size)
{
	if (m1 && m2 && (size > 0)) {
#ifndef BSD
		(void) memcpy(m1, m2, size);
#else
		(void) bcopy(m2, m1, size);
#endif
		return 0;
	}
	return -1;
}

/* malloc that will never return null */
void           *
mallocnn(int s)
{



( run in 0.504 second using v1.01-cache-2.11-cpan-ceb78f64989 )