inaccessible), or NULL for loaded_script_texts. */
const char *full_path;
- /* Non-zero if this script has been loaded. */
- int loaded;
+ /* True if this script has been loaded. */
+ bool loaded;
const struct extension_language_defn *language;
};
}
/* Add script file NAME in LANGUAGE to hash table of PSPACE_INFO.
- LOADED 1 if the script has been (is going to) be loaded, 0 otherwise
- (such as if it has not been found).
+ LOADED is true if the script has been (is going to) be loaded, false
+ otherwise (such as if it has not been found).
FULL_PATH is NULL if the script wasn't found.
+
The result is true if the script was already in the hash table. */
-static int
-maybe_add_script_file (struct auto_load_pspace_info *pspace_info, int loaded,
+static bool
+maybe_add_script_file (struct auto_load_pspace_info *pspace_info, bool loaded,
const char *name, const char *full_path,
const struct extension_language_defn *language)
{
struct htab *htab = pspace_info->loaded_script_files.get ();
struct loaded_script **slot, entry;
- int in_hash_table;
entry.name = name;
entry.language = language;
slot = (struct loaded_script **) htab_find_slot (htab, &entry, INSERT);
- in_hash_table = *slot != NULL;
+ bool in_hash_table = *slot != NULL;
/* If this script is not in the hash table, add it. */
}
/* Add script contents NAME in LANGUAGE to hash table of PSPACE_INFO.
- LOADED 1 if the script has been (is going to) be loaded, 0 otherwise
- (such as if it has not been found).
+ LOADED is true if the script has been (is going to) be loaded, false
+ otherwise (such as if it has not been found).
+
The result is true if the script was already in the hash table. */
-static int
+static bool
maybe_add_script_text (struct auto_load_pspace_info *pspace_info,
- int loaded, const char *name,
+ bool loaded, const char *name,
const struct extension_language_defn *language)
{
struct htab *htab = pspace_info->loaded_script_texts.get ();
struct loaded_script **slot, entry;
- int in_hash_table;
entry.name = name;
entry.language = language;
slot = (struct loaded_script **) htab_find_slot (htab, &entry, INSERT);
- in_hash_table = *slot != NULL;
+ bool in_hash_table = *slot != NULL;
/* If this script is not in the hash table, add it. */
const char *section_name, unsigned int offset,
const char *file)
{
- int in_hash_table;
objfile_script_sourcer_func *sourcer;
/* Skip this script if support is not compiled in. */
section_name, offset);
}
- in_hash_table = maybe_add_script_file (pspace_info, bool (opened), file,
- (opened
- ? opened->full_path.get ()
- : NULL),
- language);
+ bool in_hash_table
+ = maybe_add_script_file (pspace_info, bool (opened), file,
+ (opened ? opened->full_path.get (): NULL),
+ language);
/* If this file is not currently loaded, load it. */
if (opened && !in_hash_table)
objfile_script_executor_func *executor;
const char *newline, *script_text;
const char *name;
- int in_hash_table;
/* The first line of the script is the name of the script.
It must not contain any kind of space character. */
ext_lang_name (language), name,
section_name, objfile_name (objfile));
- in_hash_table = maybe_add_script_text (pspace_info, is_safe, name, language);
+ bool in_hash_table
+ = maybe_add_script_text (pspace_info, is_safe, name, language);
/* If this file is not currently loaded, load it. */
if (is_safe && !in_hash_table)