Blame src/internal/apimagic_errinfo_impl.c

bbcd7d
#include <apimagic/apimagic.h>
bbcd7d
#include "apimagic_driver_impl.h"
bbcd7d
#include "apimagic_errinfo_impl.h"
bbcd7d
bbcd7d
int amgc_record_error(
bbcd7d
	const struct amgc_driver_ctx *	dctx,
bbcd7d
	int				esyscode,
bbcd7d
	int				elibcode,
bbcd7d
	const char *			efunction,
bbcd7d
	int				eline,
bbcd7d
	unsigned			eflags,
bbcd7d
	void *				eany)
bbcd7d
{
bbcd7d
	struct amgc_driver_ctx_impl *	ictx;
bbcd7d
	struct amgc_error_info *	erri;
bbcd7d
bbcd7d
	ictx = amgc_get_driver_ictx(dctx);
bbcd7d
bbcd7d
	if (ictx->errinfp == ictx->erricap)
bbcd7d
		return -1;
bbcd7d
bbcd7d
	*ictx->errinfp = &ictx->erribuf[ictx->errinfp - ictx->erriptr];
bbcd7d
	erri = *ictx->errinfp;
bbcd7d
bbcd7d
	erri->euctx     = ictx->euctx;
bbcd7d
	erri->eunit     = ictx->eunit;
bbcd7d
bbcd7d
	erri->edctx     = dctx;
bbcd7d
	erri->esyscode  = esyscode;
bbcd7d
	erri->elibcode  = elibcode;
bbcd7d
	erri->efunction = efunction;
bbcd7d
	erri->eline     = eline;
bbcd7d
	erri->eflags    = eflags;
bbcd7d
	erri->eany      = eany;
bbcd7d
bbcd7d
	ictx->errinfp++;
bbcd7d
bbcd7d
	return -1;
bbcd7d
}