make outname print where it came from in case of error

This commit is contained in:
christos 2014-04-17 18:52:03 +00:00
parent a20e9a10c9
commit 20ba703761
2 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: emit.c,v 1.5 2009/04/15 01:20:57 christos Exp $ */
/* $NetBSD: emit.c,v 1.6 2014/04/17 18:52:03 christos Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: emit.c,v 1.5 2009/04/15 01:20:57 christos Exp $");
__RCSID("$NetBSD: emit.c,v 1.6 2014/04/17 18:52:03 christos Exp $");
#endif
#include <ctype.h>
@ -216,11 +216,11 @@ outint(int i)
* the name is preceded by its length
*/
void
outname(const char *name)
outname1(const char *file, size_t line, const char *name)
{
if (name == NULL)
errx(1, "internal error: outname() 1");
errx(1, "%s, %zu: internal error: outname(NULL)", file, line);
outint((int)strlen(name));
outstrg(name);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: externs.h,v 1.4 2005/04/07 16:28:40 christos Exp $ */
/* $NetBSD: externs.h,v 1.5 2014/04/17 18:52:03 christos Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -69,5 +69,6 @@ extern void outchar(int);
extern void outqchar(int);
extern void outstrg(const char *);
extern void outint(int);
extern void outname(const char *);
#define outname(a) outname1(__FILE__, __LINE__, a);
extern void outname1(const char *, size_t, const char *);
extern void outsrc(const char *);