This PR aims to improve the flexibility of argtable3 configuration options. With these changes, including argtable3 into other projects becomes easier, since the source code of argtable3 no longer has to be modified. This allows, for example, using the original source files from Github Releases of argtable3, instead of vendoring the argtable3 source code into the project.
feat: Make ARG_ENABLE_TRACE and ARG_ENABLE_LOG configurable
Currently to configure ARG_ENABLE_TRACE or ARG_ENABLE_LOG, we have to modify argtable3 source code. This commit allows setting these options via the compiler flags.
feat: make configuration options from argtable3.h configurable
Currently several argtable3 options can be modified only by changing them in source code. This commit makes these options configurable by adding ifndef guards: ARG_DSTR_SIZE, ARG_CMD_NAME_LEN, ARG_CMD_DESCRIPTION_LEN.
Additionally, ARG_DSTR_SIZE and ARG_REPLACE_GETOPT options are moved to argtable_private.h. This is done for two reasons:
Having them in argtable_private.h allows defining compiler flags (such as -DARG_DSTR_SIZE=100) for argtable3 files only. If the definitions are in the public header file (argtable3.h) then technically we have to pass -DARG_DSTR_SIZE=100 also to other files in the project, so that they evaluate argtable3.h in the same way.
Having them in argtable3.h is actually not necessary, since they are not used anywhere in the public interface.
Testing
I have checked that make && make test still pass after these changes.
This PR aims to improve the flexibility of argtable3 configuration options. With these changes, including argtable3 into other projects becomes easier, since the source code of argtable3 no longer has to be modified. This allows, for example, using the original source files from Github Releases of argtable3, instead of vendoring the argtable3 source code into the project.
feat: Make ARG_ENABLE_TRACE and ARG_ENABLE_LOG configurable
Currently to configure ARG_ENABLE_TRACE or ARG_ENABLE_LOG, we have to modify argtable3 source code. This commit allows setting these options via the compiler flags.
feat: make configuration options from argtable3.h configurable
Currently several argtable3 options can be modified only by changing them in source code. This commit makes these options configurable by adding ifndef guards:
ARG_DSTR_SIZE
,ARG_CMD_NAME_LEN
,ARG_CMD_DESCRIPTION_LEN
.Additionally,
ARG_DSTR_SIZE
andARG_REPLACE_GETOPT
options are moved to argtable_private.h. This is done for two reasons:Having them in argtable_private.h allows defining compiler flags (such as
-DARG_DSTR_SIZE=100
) for argtable3 files only. If the definitions are in the public header file (argtable3.h) then technically we have to pass-DARG_DSTR_SIZE=100
also to other files in the project, so that they evaluate argtable3.h in the same way.Having them in argtable3.h is actually not necessary, since they are not used anywhere in the public interface.
Testing
I have checked that
make && make test
still pass after these changes.