This is basically a continuation of the work from #1002 but her for the
camlibs directory. The purpose was to replace spaces as a means for
indentation with tab characters.
Note: there are some files which are still offending the general
rule but are (mostly) consistent within themselves. I let them be for
the moment. Fixing them would basically replace the whole file.
Also: there are still a ton of whitespace related inconsistencies like
"x=10" vs "x = 10" or "func(10)" vs "func (10)".
This is a whitespace only change (if you include newlines as whitespace).
This replaces the verbose and error prone pattern of calling
str = malloc(strlen("some value is 12345678"));
sprintf(str, "some value is %d", val)
with
str = aprintf(some value is %d", val);
This is similar to the GNU function asprintf() but returns the pointer
instead of assigning it to the first parameter. It uses the existing
gpi_vsnprintf(fmt, va_list) function.
* remove trailing whitespace in *.c/*.h files
This is now 'enforced' via .editoconfig. Do it here once to prevent random
ws changes during editing.
* Cleanup intra-line whitespace in large submenu tables in config.c
Consistently use spaces to layout columns, to make it independent of tab
size.
---------
Co-authored-by: axxel <awagger@web.de>
* examples
* gphoto2
* libgphoto2
* libgphoto2_port
The code (at least in this part of the project) is effectively formated
using tabs with a tab-size of 8 as a means for indentation.
There have been a few places where spaces were introduced. Some obviously
with an indent size of 8 in mind, others with an indent size of 4.
This commit tries its best to make the use of tabs consistent again, at
least for indenting lines. The "intra line" indentation (white space after
the first non-white-space character) is still a bit of a mess.
Co-authored-by: axxel <awagger@web.de>
This switches the arguments of calloc() in a few cases such that
the sizeof() does not happen in the nmemb first argument.
An example warning would be
warning: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
This is the variant of commit f97c27efe9
with the typo removed which broke compilation.
This switches the arguments of calloc() in a few cases such that
the sizeof() does not happen in the nmemb first argument.
An example warning would be
warning: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
Most of the examples give wrong impression that `GP_UNKNOWN_EVENT` data does not need to be freed / is not heap allocated, however it's not the case - those messages are always `malloc`'d by corresponding drivers.
C preprocessor macros beginning/ending with underscores are
reserved for system use as well as macros containing a double
underscore anywhere, so application software macros are
supposed to be named differently.
For a header file gphoto2-abilities-list.h, this
consistently uses a macro name
LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H
for the usual
#ifndef LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H
#define LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H
... content of the header file ...
#endif /* !defined(LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H) */
Found using "clang -Weverything".
This should work, unless when run with an ancient C preprocessor
which might only the first 8 or 10 characters to distinguish
macro names and ignores the remainder of the name.
Any TESTS definition causes "make check" to run a test suite,
even if no tests are actually defined.
So we remove the empty TESTS= from examples/Makefile.am, and
keep on using the TESTS in the tests/Makefile.am file.