Commit Graph

18 Commits

Author SHA1 Message Date
rillig c8c1f26895 make: remove bmake_free
It was only used in 2 places, and in both these places, the pointer was
never null.
2021-12-15 11:01:39 +00:00
rillig 7371a30a76 make: mark several functions whose result must be used
Suggested by sjg, to catch more bugs like the memory leak in cond.c
1.303 from 2021-12-13.

No binary change.
2021-12-15 09:53:41 +00:00
rillig 85aee7a6f7 make(1): remove do-not-format markers from comments
These markers had been used inconsistently.  Furthermore the source code
had not been formatted automatically before 2020 at all, otherwise there
wouldn't have been any trailing whitespace left.
2021-01-19 20:51:46 +00:00
rillig b754dcb0cc make(1): format multi-line comments 2020-12-30 10:03:16 +00:00
rillig 4743be9ab6 make(1): indent hash.h and make_malloc.h with tabs instead of spaces 2020-12-15 01:23:55 +00:00
rillig a40fe9f746 make(1): use consistent definition for MAKE_INLINE 2020-11-10 00:32:12 +00:00
rillig 8288993505 make(1): clean up headers, no functional change 2020-10-19 23:43:55 +00:00
rillig de337db564 make(1): fix position of MAKE_ATTR_UNUSED in inline functions
The attribute needs to be before the return type, otherwise GCC 5
complains that Hash_GetValue is defined but not used, when compiling
with USER_CPPFLAGS=-Dinline=.  The other functions don't get any
warnings.  It's probably because Hash_GetValue is the only inline
function that returns a pointer.
2020-09-13 15:27:25 +00:00
rillig 64e0a331dc make(1): fix build with -DUSE_EMALLOC 2020-08-29 16:47:45 +00:00
rillig 23181bcce8 make(1): add bmake_strsedup for duplicating a substring 2020-08-29 11:24:54 +00:00
rillig a3c983f271 make(1): allow make to be compiled in C90 mode
Since the inline functions are the only C99 feature used by now, setting
USER_CFLAGS='-std=c90 -ansi -Dinline=' is enough for compiling make with
a C90 compiler.
2020-08-25 17:37:09 +00:00
rillig 0cbd5c0e4f make(1): remove unreached code from bmake_strndup
The "at most" branch was never taken since all call sites in var.c only
ever need a substring, and the target buffer is not limited.  Therefore
rename the function and make it simpler.

It's ok that bmake_strldup is defined as estrndup in case of USE_EMALLOC
since that function's implementation is compatible to the "copy
exactly", it just contains some extra null checks that will never match
since the variable values cannot (well, or should not) contain null
bytes.  Theoretically they can, but the behavior then depends on the
exact implementation and is unreliable, therefore nobody does this.
After all, Makefiles are used for text processing, not for binary data.
2020-08-20 06:35:14 +00:00
rillig bdd5655235 make(1): use consistent indentation in source code
Tabs for multiples of 8, then spaces.

The usage string has been kept as-is since the spaces there are
indentional and do influence the output.
2020-08-01 14:47:49 +00:00
rillig ad6695e0a6 make(1): avoid calls to free(3) in the common case of a NULL pointer 2020-08-01 09:55:00 +00:00
dsl 97347d2cbb Fixes to includes of make_malloc.h to that it actually builds when
USE_EMALLOC is undefined.
Fixes earlier fixes :-)
2009-01-24 14:43:28 +00:00
cegger 9fde1a673e buildfixes for OSX:
- include <sys/types> for size_t
- progname is undeclared
- include <string.h> for string functions like strlen()
- include <errno.h> for errno
2009-01-24 13:06:16 +00:00
cegger e6227c556c buildfix: remove RCSID. It conflicts with the definition in the .c files. 2009-01-24 12:59:51 +00:00
dsl 4fb693c12c Move the bmake_malloc() functions into their own .c and .h files.
Include instead of make.h in a few places.
2009-01-24 11:59:39 +00:00