diff options
| author | Paul Eggert | 2021-10-03 16:37:13 -0700 |
|---|---|---|
| committer | Paul Eggert | 2021-10-03 16:55:17 -0700 |
| commit | fd274d7d24ec35d64974b007cfe881c0e07edf9d (patch) | |
| tree | dde456735d2dcbc8818245d97df23ab89678681f /src | |
| parent | cc3fc94f09332e5cca28fea1f19a93c8d45fd0f8 (diff) | |
| download | emacs-fd274d7d24ec35d64974b007cfe881c0e07edf9d.tar.gz emacs-fd274d7d24ec35d64974b007cfe881c0e07edf9d.zip | |
Pacify -Wanalyzer-null-argument in lisp_malloc
* src/alloc.c (lisp_malloc): Document that NBYTES must be
positive, and omit a needless runtime check. This pacifies a
false alarm with gcc 11.2.1 -Wanalyzer-possible-null-dereference.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/alloc.c b/src/alloc.c index 0895a0f52aa..0c04d5cde05 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -988,7 +988,8 @@ record_xmalloc (size_t size) | |||
| 988 | 988 | ||
| 989 | /* Like malloc but used for allocating Lisp data. NBYTES is the | 989 | /* Like malloc but used for allocating Lisp data. NBYTES is the |
| 990 | number of bytes to allocate, TYPE describes the intended use of the | 990 | number of bytes to allocate, TYPE describes the intended use of the |
| 991 | allocated memory block (for strings, for conses, ...). */ | 991 | allocated memory block (for strings, for conses, ...). |
| 992 | NBYTES must be positive. */ | ||
| 992 | 993 | ||
| 993 | #if ! USE_LSB_TAG | 994 | #if ! USE_LSB_TAG |
| 994 | void *lisp_malloc_loser EXTERNALLY_VISIBLE; | 995 | void *lisp_malloc_loser EXTERNALLY_VISIBLE; |
| @@ -1030,7 +1031,7 @@ lisp_malloc (size_t nbytes, bool clearit, enum mem_type type) | |||
| 1030 | #endif | 1031 | #endif |
| 1031 | 1032 | ||
| 1032 | MALLOC_UNBLOCK_INPUT; | 1033 | MALLOC_UNBLOCK_INPUT; |
| 1033 | if (!val && nbytes) | 1034 | if (!val) |
| 1034 | memory_full (nbytes); | 1035 | memory_full (nbytes); |
| 1035 | MALLOC_PROBE (nbytes); | 1036 | MALLOC_PROBE (nbytes); |
| 1036 | return val; | 1037 | return val; |