X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=src%2Fsymbols.c;h=90ec3bfe427cdc85fa9e2586bbbc68d8ad144fbd;hb=c881aa3386c00d7021ffabf2f66275d6c110c1c1;hp=d2f42dac576c4c2d7e01a8ca89b9fd074c9fc173;hpb=8760c1ba6442153afe76bcac742e086f90c59fe8;p=inform.git diff --git a/src/symbols.c b/src/symbols.c index d2f42da..90ec3bf 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -2,7 +2,7 @@ /* "symbols" : The symbols table; creating stock of reserved words */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -1223,6 +1223,8 @@ uint32 df_stripped_offset_for_code_offset(uint32 offset, int *stripped) { df_function_t *func; int count; + int beg; + int end; if (!track_unused_routines) compiler_error("DF: df_stripped_offset_for_code_offset called, but function references have not been mapped"); @@ -1250,13 +1252,14 @@ uint32 df_stripped_offset_for_code_offset(uint32 offset, int *stripped) /* Do a binary search. Maintain beg <= res < end, where res is the function containing the desired address. */ - int beg = 0; - int end = df_functions_sorted_count; + beg = 0; + end = df_functions_sorted_count; /* Set stripped flag until we decide on a non-stripped function. */ *stripped = TRUE; while (1) { + int new; if (beg >= end) { error("DF: offset_for_code_offset: Could not locate address."); return 0; @@ -1268,7 +1271,7 @@ uint32 df_stripped_offset_for_code_offset(uint32 offset, int *stripped) *stripped = FALSE; return func->newaddress + (offset - func->address); } - int new = (beg + end) / 2; + new = (beg + end) / 2; if (new <= beg || new >= end) compiler_error("DF: binary search went off the rails");