(int nargs, Lisp_Object * args))
{
int ac;
- const Extbyte *wampum;
+ const Extbyte *wampum = NULL;
int namesize;
int total_len;
Lisp_Object orig_invoc_name = Fcar(Vcommand_line_args);
TO_EXTERNAL_FORMAT(LISP_STRING, orig_invoc_name,
ALLOCA, (wampum, namesize), Qnative);
+ if ( wampum == NULL )
+ error("Could not transcode invocation name");
+
namesize++;
for (ac = 0, total_len = namesize; ac < nargs; ac++) {
CHECK_STRING(args[ac]);
+ wampum_all[ac]=NULL;
TO_EXTERNAL_FORMAT(LISP_STRING, args[ac],
ALLOCA, (wampum_all[ac], wampum_all_len[ac]),
Qnative);
+ if(wampum_all[ac]==NULL) {
+ error("Could not transcode arguments");
+ }
wampum_all_len[ac]++;
total_len += wampum_all_len[ac];
}
(':' or whatever). */
Lisp_Object decode_path(/*const*/ char *path)
{
- Bytecount newlen;
- Bufbyte *newpath;
+ Bytecount newlen = 0;
+ Bufbyte *newpath = NULL;
if (!path)
return Qnil;
decode_env_path(), but it looks dubious here. Does any code
depend on decode_path("") returning nil instead of an empty
string? */
- if (!newlen)
+ if (!newlen || !newpath)
return Qnil;
return split_string_by_emchar_1(newpath, newlen, SEPCHAR);
return noninteractive ? Qt : Qnil;
}
+#ifdef USE_ASSERTIONS
+static int in_assert_failed = 0;
+static const char *assert_failed_file = NULL;
+static int assert_failed_line = 0;
+static const char *assert_failed_expr = NULL;
/* This flag is useful to define if you're under a debugger; this way, you
can put a breakpoint of assert_failed() and debug multiple problems
in one session without having to recompile. */
-/* #define ASSERTIONS_DONT_ABORT */
-
-#ifdef USE_ASSERTIONS
-/* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */
-
-static int in_assert_failed;
-static const char *assert_failed_file;
-static int assert_failed_line;
-static const char *assert_failed_expr;
+static int assertions_dont_abort = 0;
#ifdef fprintf
#undef fprintf
#endif
+#ifdef abort
#undef abort /* avoid infinite #define loop... */
+#endif
#define enter_debugger()
_exit(-1);
else if (in_assert_failed == 3) {
enter_debugger();
- _exit(-1);
+ abort();
} else if (in_assert_failed == 2) {
/* Not stderr_out(), which does additional things and may trigger
a recursive assertion failure. fprintf was undeffed above, in
case it was encapsulated. */
fprintf(stderr,
- "\nFatal error: recursive assertion failure, "
+ "\n\nFatal error: recursive assertion failure, "
"file %s, line %d, %s\n", file, line, expr);
fprintf(stderr,
"Original assertion failure: file %s, line %d, %s\n",
assert_failed_file, assert_failed_line,
assert_failed_expr);
+ fflush(stderr);
+ enter_debugger();
+ debug_short_backtrace(0x7FFF);
} else {
assert_failed_file = file;
assert_failed_line = line;
stderr_out
("\nFatal error: assertion failed, file %s, line %d, %s\n",
file, line, expr);
+ fflush(stderr);
+ enter_debugger();
+ debug_backtrace();
+ }
+ if (! assertions_dont_abort) {
+ abort();
}
- fflush(stderr);
-
- enter_debugger();
-#if !defined (ASSERTIONS_DONT_ABORT)
- abort();
-#endif
inhibit_non_essential_printing_operations = 0;
in_assert_failed = 0;
}