aboutsummaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2022-09-06 18:39:07 +0300
committerMartin Storsjö <martin@martin.st>2022-09-12 11:07:35 +0300
commit825a844fdcfd4532cddde14d7bb38f1f981fa9fe (patch)
tree7a0e6ab9ef7c9bc1fbac6a8abbadef4c28453cce /ld/pe-dll.c
parenta33a94cf432e449461b7ddcc22b6f5a886cd3315 (diff)
downloadfsf-binutils-gdb-825a844fdcfd4532cddde14d7bb38f1f981fa9fe.zip
fsf-binutils-gdb-825a844fdcfd4532cddde14d7bb38f1f981fa9fe.tar.gz
fsf-binutils-gdb-825a844fdcfd4532cddde14d7bb38f1f981fa9fe.tar.bz2
ld: pe: Apply review suggestions on the existing exports/imports arrays
Use a separate explicit max_exports/imports field, instead of deducing it from the number of allocated elements. Use a named constant for the incremental growth of the array. Use bool instead of int for boolean values. Remove an unnecessary if statement/scope in the def_file_free function. Add more verbose comments about parameters, and about insertion into an array of structs. Generally use unsigned integers for all array indices and sizes. The num_exports/imports fields are kept as is as signed integers, since changing them to unsigned would require a disproportionate amount of changes ti pe-dll.c to avoid comparisons between signed and unsigned. Simply use xrealloc instead of a check and xmalloc/xrealloc; xrealloc can take NULL as the first parameter (and does a similar check internally). (This wasn't requested in review though, but noticed while working on the code.)
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index 60584a8..92c33f5 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -791,7 +791,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
if (auto_export (b, pe_def_file, sn))
{
- int is_dup = 0;
+ bool is_dup = false;
def_file_export *p;
p = def_file_add_export (pe_def_file, sn, 0, -1,
@@ -857,7 +857,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
if (strchr (pe_def_file->exports[i].name, '@'))
{
- int is_dup = 1;
+ bool is_dup = true;
int lead_at = (*pe_def_file->exports[i].name == '@');
char *tmp = xstrdup (pe_def_file->exports[i].name + lead_at);
@@ -3579,7 +3579,7 @@ pe_implied_import_dll (const char *filename)
exported in buggy auto-import releases. */
if (! startswith (erva + name_rva, "__nm_"))
{
- int is_dup = 0;
+ bool is_dup = false;
/* is_data is true if the address is in the data, rdata or bss
segment. */
is_data =