This code is under #ifndef LIBRAW_LIBRARY_BUILD, so it is not compiled into LibRaw (because LibRaw is compiled with LIBRAW_LIBRARY_BUILD defined).
LibRaw's code snippet is mostly the same, but without document_mode into account. And it is not wrong.
Histogram: LibRaw calls convert_to_rgb_loop() virtual function. If you do not need histogram calculation, you may provide your own convert_to_rgb_loop() in derived class. The histogram is needed for automatic brightness correction (if used).
This code is under #ifndef LIBRAW_LIBRARY_BUILD, so it is not compiled into LibRaw (because LibRaw is compiled with LIBRAW_LIBRARY_BUILD defined).
LibRaw's code snippet is mostly the same, but without document_mode into account. And it is not wrong.
Histogram: LibRaw calls convert_to_rgb_loop() virtual function. If you do not need histogram calculation, you may provide your own convert_to_rgb_loop() in derived class. The histogram is needed for automatic brightness correction (if used).