- one lonesome software engineer's trek into the darkness

Graywolf on Gitlab

Stacks Image 348
There was the occasional bug fixed in the code, but the main differences were to make it 64-bit clean, and to fix all the warnings and errors that clang spewed out when trying to compile the original. The patches include but are not limited to:

  • Use function prototypes and declare missing function parameters
  • Correct return values from functions
  • Wrap if(assign) into if ((assign)) to prevent compiler warnings. At least a couple of these were bugs
  • Remove unused variables and functions
  • Initialise variables that might otherwise be used without initial values
  • Fix the number of arguments in printf() statements
  • Create header files for exported functions
  • Make the lex/yacc -derived parsers work under OSX
  • Add #include statements so that functions are declared before use
  • Coerce types before passing to system library functions so that they match the correct conventions
  • Re-type functions that take floats to take doubles, since K&R does an auto-promote of a float to a double
  • Coerce 64-bit ints into 32-bit ones for output purposes (we use 64-bit values to prevent problems with the hashtable pointer sizes being different from the integer size. We don’t need the extra 32 bits)
  • Deal with incoming integer values (sscanf, fscanf) properly by importing into a 32-bit int and then setting the 64-bit value

Anyway, the code with all these fixes is now available at github