Because we have allocated enough space, it is a waste of time to check the
size after copy and cat; beside the use of plain strxxx functions may allow
compiler to make a better job.
As pointed by Coverity, the type used to calculate the size to allocate was
not the right one. It now gets the compiler to deduce it from the variable
for which the memory is allocated.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The function wrealloc never fails, and allocates enough storage to store
the resulting string, so it is useless to check if strcat failed.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The previous syntax used an explicit cast to remove the CONST
attribute, but the right way is to keep the attribute and store
the result in a variable which is defined properly.
A number of functions do not actually modify the strings given as
parameter, but only read or duplicate it. In this case it is a good
practice to mark that parameter as pointer-to-const to let the
compiler known about it, to be able to perform appropriate
optimisations.
* Remove assigned but not used variables (GCC 4.6)
* Bump _XOPEN_SOURCE to 600, ridding of FreeBSD warnings (this probably need
to be tweaked on a per-implementation basis as problems arise)
On BSD systems, strlcat and strlcpy are included in the C library and
nothing special is needed. On Linux systems they are not, but libbsd may
be available to provide them. Use it if so.
This also adds wstrlcat and wstrlcpy instead of trying to maybe-provide
strlcat and strlcpy themselves, as that way there is no risk of symbol
conflicts. Not bumping the library version at this time, that should be
done (if necessary) before release.
Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
Remove local strcasecmp implementation; whatever system doesn't have it
is off the table for now.
memcmp is used by WINGs; add autoconf check
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
make wtrimspace() use wings' own function for a task
semantics change: it used to segfault given null, now it returns null.
this doesn't affect any current use (there's exactly one..), and i see
no harm in this behaviour, and perceive this to be more natural.
wtokenfree() does not free the first entry of an array.
If count is 1 then
while (--count)
will be
while (0)
and the inner body of that while-loop will not be entered.
Therefore a memory leak happens every time wtokenfree() is called.
Retrieved-from: http://paldium.homeunix.org/tobias/wmaker/patches/
[crmafra: This patch, altough correct, breaks WPrefs.app, which will be
fixed by the next patch. ]
for arq in `git ls-files *.c`; do
echo $arq;
indent -linux -l115 $arq;
done
The different line break at 115 columns is because
I use a widescreen monitor :-)