simgear/nasal/code.c:logError(): simplified the code.
This commit is contained in:
@@ -983,16 +983,14 @@ naRef naContinue(naContext ctx)
|
|||||||
|
|
||||||
static void logError(naContext ctx)
|
static void logError(naContext ctx)
|
||||||
{
|
{
|
||||||
int i, stack_depth = naStackDepth(ctx);
|
|
||||||
printf("Nasal runtime error: %s\n", naGetError(ctx));
|
printf("Nasal runtime error: %s\n", naGetError(ctx));
|
||||||
if( stack_depth < 1 )
|
int stack_depth = naStackDepth(ctx);
|
||||||
return;
|
for (int i=0; i<stack_depth; ++i) {
|
||||||
printf(" at %s\n", naStr_data(naGetSourceFile(ctx, 0)));
|
printf(" %s: %s, line %d\n",
|
||||||
printf(", line %d\n", naGetLine(ctx, 0));
|
i ? "called from" : "at",
|
||||||
for(i = 1; i < stack_depth; ++i )
|
|
||||||
printf( " called from: %s, line %d",
|
|
||||||
naStr_data(naGetSourceFile(ctx, i)),
|
naStr_data(naGetSourceFile(ctx, i)),
|
||||||
naGetLine(ctx, i));
|
naGetLine(ctx, i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static naErrorHandler error_handler = &logError;
|
static naErrorHandler error_handler = &logError;
|
||||||
|
|||||||
Reference in New Issue
Block a user