Commit 4ec81bec authored by Niels Möller's avatar Niels Möller
Browse files

* src/werror.c (logfile_flag): Deleted global variable.

(werror_vformat): Added %t, for printing the object type.

Rev: src/werror.c:1.61
Rev: src/werror.h:1.29
parent 4f797ec6
......@@ -426,21 +426,6 @@ werror_vformat(const char *f, va_list args)
case 'n':
werror_bignum(va_arg(args, MP_INT *), do_hex ? 16 : 10);
break;
case 'z':
{
char *s = va_arg(args, char *);
if (do_hex)
werror_hexdump(strlen(s), s);
else if (do_paranoia)
while (*s)
werror_paranoia_putc(*s++);
else
werror_write(strlen(s), s);
break;
}
case 'a':
{
int atom = va_arg(args, int);
......@@ -517,9 +502,40 @@ werror_vformat(const char *f, va_list args)
if (do_free)
lsh_string_free(s);
break;
}
case 't':
{
struct lsh_object *o = va_arg(args, struct lsh_object *);
const char *type;
if (!o)
type = "<NULL>";
else if (o->isa)
type = o->isa->name;
else
type = "<STATIC>";
werror_write(strlen(type), type);
break;
}
case 'z':
{
char *s = va_arg(args, char *);
if (do_hex)
werror_hexdump(strlen(s), s);
else if (do_paranoia)
while (*s)
werror_paranoia_putc(*s++);
else
werror_write(strlen(s), s);
break;
}
default:
fatal("werror_vformat: bad format string!\n");
break;
......
......@@ -62,6 +62,7 @@ void set_error_syslog(const char *id);
* %a Insert a string containing one atom.
* %s UINT32 length, UINT8 *data
* %S lsh_string *s
* %t The type of an struct lsh_object *
*
* Modifiers:
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment