OK, the xstrtol.c
file is where the function is really defined, but this source file is included into other source files, acting like a C++ function template, to generate functions with slightly different names and behavior.
Look at xstrtoul.c. It actually includes xstrtol.c but defines several preprocessor symbols to modify the template function generation:
#define __strtol strtoul
#define __strtol_t unsigned long int
#define __xstrtol xstrtoul
#define STRTOL_T_MINIMUM 0
#define STRTOL_T_MAXIMUM ULONG_MAX
#include "xstrtol.c"
It's unusual (but not unheard-of) to include a .c
file into another .c
file.
In C++, there are file naming conventions used for the similar situation where template definitions are defined in a .tcc
file which is #included
at the end of a .hpp
header file.