X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=src%2Fsymbols.c;h=90ec3bfe427cdc85fa9e2586bbbc68d8ad144fbd;hb=c881aa3386c00d7021ffabf2f66275d6c110c1c1;hp=91d5f2ed7c0dd92099d3c6df4b50726f27223e6e;hpb=46cb3ffad9e3ed318a9109ff96421882f6642b2b;p=inform.git diff --git a/src/symbols.c b/src/symbols.c index 91d5f2e..90ec3bf 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -1,9 +1,8 @@ /* ------------------------------------------------------------------------- */ /* "symbols" : The symbols table; creating stock of reserved words */ /* */ -/* Copyright (c) Graham Nelson 1993 - 2020 */ -/* */ -/* This file is part of Inform. */ +/* Part of Inform 6.35 */ +/* 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 */ @@ -16,7 +15,7 @@ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ -/* along with Inform. If not, see https://gnu.org/licenses/ */ +/* along with Inform. If not, see https://gnu.org/licenses/ * /* */ /* ------------------------------------------------------------------------- */ @@ -1224,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"); @@ -1251,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; @@ -1269,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");