Exemplo n.º 1
0
/*
 *	Reallocate a chunk of memory and terminate the application on failure
 */
void *Erealloc(void *p1, size_t size)
{	void *p;

	DBG_ENTER("Erealloc", Suppl_error)
	DBG_ARGUMENTS( ("poi=%p, new_len=%u", p1, size) )

	chkHeap
	if((p = realloc(p1, size)) == 0 && size)
		Esuppl_noMem();
	chkHeap
	DBG_RETURN_P( p)
}
Exemplo n.º 2
0
/*
 *	Allocate a chunk of memory
 *	On failure: Terminate with an error message
 */
void *Emalloc(size_t size)
{	byte *h;

	DBG_ENTER("Emalloc", Suppl_error)
	DBG_ARGUMENTS( ("len=%u", size) )

	chkHeap
	if((h = malloc(size)) == 0)
		Esuppl_noMem();

	chkHeap
	DBG_RETURN_P( h)
}
Exemplo n.º 3
0
void suppl_log_log_header(void)
{	char *fnam;
	nlstime t;

	assert(suppl_Stack);

	if(!suppl_log_lock())
		return;

	/* Open the logfile if not done so already */
	if(!suppl_l_logfile) {
		/* If to lock the debug package fails, _item() and _trailer()
			will silently ignore any calls */
		chkHeap
		if((fnam = appNameEx()) == 0)
			Esuppl_noMem();
		fnam = EStrConcat(2, fnam, DBG_EXTENSION);
		suppl_l_logfile = Eopen(fnam, suppl_l_openmode);
		chkHeap
		free(fnam);
	}
Exemplo n.º 4
0
void openlog(const char * const ident, int option, int  facility)
{	static FLAG8 recursive = 0;			/* to prevent recursive calls
											to openlog() when using
											syslogo() */
	DBG_ENTER("openlog", Suppl_syslog)

		/* "++semaphore" is considered an atomic operation by
			many programs; it's native C's best approximation
			for the P(semaphore) operation */
	if(++recursive == 1		/* not recursively called */
	 && ++syslog_opencount == 1) {	/* not opened til now */
	 	/* When these statements are executed, no logfile has
	 		been opened so far. That means that they can be logged
	 		onto STDERR only. */
		chkHeap
		syslog_options = option;
		syslog_facility = facility;
		syslog_ident = Estrdup(ident);
		if((syslog_fnam = appNameEx()) == 0)
			Esuppl_noMem();
		syslog_fnam = SYSLOG_FNAM(syslog_fnam);
		syslog_logfile = Eopen(syslog_fnam, syslog_openmode);
		chkHeap
	}