SymbolExtras: A bit of spring cleaning
authorBen Gamari <ben@smart-cactus.org>
Thu, 2 Mar 2017 16:20:12 +0000 (11:20 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 2 Mar 2017 16:31:20 +0000 (11:31 -0500)
Const-hygiene and use bool when possible.

rts/linker/SymbolExtras.c
rts/linker/SymbolExtras.h

index 468b3a9..73f219f 100644 (file)
@@ -103,7 +103,7 @@ int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first )
 
 
 #ifndef arm_HOST_ARCH
-SymbolExtra* makeSymbolExtra( ObjectCode* oc,
+SymbolExtra* makeSymbolExtra( ObjectCode const* oc,
                               unsigned long symbolNumber,
                               unsigned long target )
 {
@@ -169,18 +169,16 @@ SymbolExtra* makeSymbolExtra( ObjectCode* oc,
 */
 
 /* Produce a jump island for ARM/Thumb interworking */
-SymbolExtra* makeArmSymbolExtra( ObjectCode* oc,
+SymbolExtra* makeArmSymbolExtra( ObjectCode const* oc,
                                  unsigned long symbolNumber,
                                  unsigned long target,
-                                 int fromThumb,
-                                 int toThumb )
+                                 bool fromThumb,
+                                 bool toThumb )
 {
-  SymbolExtra *extra;
-
   ASSERT( symbolNumber >= oc->first_symbol_extra
         && symbolNumber - oc->first_symbol_extra < oc->n_symbol_extras);
 
-  extra = &oc->symbol_extras[symbolNumber - oc->first_symbol_extra];
+  SymbolExtra *extra = &oc->symbol_extras[symbolNumber - oc->first_symbol_extra];
 
   // Make sure instruction mode bit is set properly
   if (toThumb)
index c897775..5e2a6d0 100644 (file)
 int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first );
 
 #ifdef arm_HOST_ARCH
-SymbolExtra* makeArmSymbolExtra( ObjectCode* oc,
+SymbolExtra* makeArmSymbolExtra( ObjectCode const* oc,
                                  unsigned long symbolNumber,
                                  unsigned long target,
-                                 int fromThumb,
-                                 int toThumb );
+                                 bool fromThumb,
+                                 bool toThumb );
 #else
-SymbolExtra* makeSymbolExtra( ObjectCode* oc,
+SymbolExtra* makeSymbolExtra( ObjectCode const* oc,
                               unsigned long symbolNumber,
                               unsigned long target );